Monthly Archives: September 2016

  1. Rotated Sorted Array Related

    Leave a comment

    September 30, 2016 by oneOokay

    Find Minimum in Rotated Sorted Array I Find Minimum in Rotated Sorted Array II Search in Rotated Sorted Array I …
    Continue reading

  2. Wood Cut

    Leave a comment

    September 29, 2016 by oneOokay

    Given n pieces of wood with length L[i] (integer array). Cut them into small pieces to guarantee you could have …
    Continue reading

  3. 447. Search in a big sorted array

    Leave a comment

    September 29, 2016 by oneOokay

    public int searchBigSortedArray(ArrayReader reader, int target) { if (reader.get(0) > target) { return -1; } if (reader.get(0) == target) { …
    Continue reading

  4. QUICK SORT TODO

    Leave a comment

    September 29, 2016 by oneOokay

    http://www.lintcode.com/en/problem/median/  

  5. #Binary search#

    Leave a comment

    September 29, 2016 by oneOokay

    二分法???换键盘,这个键盘敲得我手指头疼=。= 基本的模板是: int start = 0; int end; while (start + 1 < end) { int mid = start + …
    Continue reading

  6. 13. strStr

    Leave a comment

    September 28, 2016 by oneOokay

    好吧,重新开始刷一遍。。。 这一题我之前想的略复杂了,想着要存储target与source第一个相等的index,以便之后不等的时候随时取回这个值再+1继续循环。 其实这里就可以直接放置两重循环来实现,第一重来循环source,第二重来循环target,每到一个source的char,尝试着进入内层循环target进行对比。此时外循环的index为source的index,也就有了target 与 source第一个相等的char的index,内层循环的index来对target和source进行判断。此时要注意的是source的index溢出。 public int strStr(String source, String target) { if (source == null || target == null) …
    Continue reading

  7. 91. Minimum Adjustment Cost

    Leave a comment

    September 26, 2016 by oneOokay

    好了ladder里面165个题目算是全部刷完了第一遍。 2/6/2016开始的算法班,口可口可,刷了有七个月。。。中间夹杂了爹妈过来过年,陪爹妈去玩,拔智齿,搬家,回国七七八八各种。 看看等第二遍刷的时候还记得多少。 网传是个“背包”问题:随便搜了点东西:以后有空看吧: DP之背包问题+记忆递归:http://www.cnblogs.com/jmzz/archive/2011/07/05/2098630.html 背包问题总结:http://sighingnow.github.io/algorithm/backpack.html 这个我觉得写的挺好的,要是能够静下心来从他的第一个解法一直看到进化完成的第四个解法,应该差不多了吧,但是我只看了最后一个解法,咳咳。以后再看吧:http://www.cnblogs.com/yuzhangcmu/p/4153927.html public int MinAdjustmentCost(ArrayList<Integer> A, int target) { if (A == null || A.size() …
    Continue reading