zoukankan      html  css  js  c++  java
  • CareercupMitbbs

    - G: a vector of strings, find a pair with max of strlen(a) * strlen(b)

      1. O(n*k): get std::bitset() of each string
      2. O(nlgn): sort strings by length
      3. O(n^2): loop from longest. Pruning: record current max strlen(a)*strlen(b), will not check any strlen(c) * strlen(d) < strlen(a) * strlen(b)

      http://www.quora.com/Given-a-dictionary-of-words-how-can-we-efficiently-find-a-pair-words-s-t-they-dont-have-characters-in-common-and-sum-of-their-length-is-maximum

    - G: count reversed pairs in an unsorted array

      Count it when conducting Merge Sort. O(nlgn)

    - G: a 0-1 valued map, filled by a rectangle or a triangle, find which one it fills..

      If not about computer vision... from[0,0] scan left->right op->down, you will find 1st vertex; rotate 90' do another scan from [width-1, 0] to find 2nd. Just to see how many vertices you find... not quite sure about this solution though.

    - G: several boxes for each can be put to another or not, find minimum area to contain all boxes

      Greedy.
      ??DP

    - GEPI: find celebrity

      O(n). Stand in a row, query pair by pair using know(i, j). Then pick the survivor.

    - FB: int array, find continuous elements with sum of k, provided.

      s[i] = sum(0..i), and hash each. for each i, check if (k - i) is in the hash

  • 相关阅读:
    VMware80端口映射
    固态硬盘安装win7系统问题。
    正向代理服务器,反向代理服务器
    Oray.com花生壳路由器配置注意
    Nginx命令
    Nginx反向代理图片总结
    C#获取视频文件播放长度
    汉语拼音的发展
    MVC 公共类App_Code不识别
    记录一下学习Android的小知识
  • 原文地址:https://www.cnblogs.com/tonix/p/4231574.html
Copyright © 2011-2022 走看看