Saturday, June 11, 2016

Algorithms to study

June 11, 2016

Prepare to write some code. Find algorithms to work on.

1. Leetcode 76: Minimum Window Substring
Study the code:
http://blog.csdn.net/sunnyyoona/article/details/43925035

2. Leetcode 91: Decode the ways
https://github.com/jianminchen/puzzles/blob/master/decode_ways.cc

2D. Leetcode 128: Longest Consecutive Sequence in Array

2E. Leetcode 139, 140, Word break

2F. Leetcode 150 Evaluate Reverse Polish Notation

3A. Leetcode 289: Game of Life
3B. Leetcode 298: Longest Consecutive Sequence in BT

4. LeetCode 351 - Android Unlock Patterns

Study the code:
http://massivealgorithms.blogspot.ca/2016/06/leetcode-351-android-unlock-patterns.html

5. Read project Euler website:

https://projecteuler.net/archives

6.  Strobogrammatic number I, II, III (246, 247, 248)

Study code:
http://buttercola.blogspot.ca/2015/08/leetcode-strobogrammatic-number.html

https://tonycao.gitbooks.io/leetcode-locked/content/LeetCode%20Locked/c1.5.html

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/246.strobogrammatic-number.java

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/247.strobogrammatic-number-ii.java

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/248.strobogrammatic-number-iii.java

7. One minute call 60 times at most

Leaky bucket algorithm
https://en.wikipedia.org/wiki/Leaky_bucket


8. Stock Maximization
https://www.hackerrank.com/challenges/stockmax

9.

http://www.careercup.com/question?id=5840928073842688

11. Leetcode: shortest word distance I, II, III
https://segmentfault.com/a/1190000003906667

study Leetcode solution:
https://github.com/MaskRay/LeetCode

12. Leetcode 53: Maximum Subarray
https://github.com/jianminchen/Leetcode_C-/blob/master/53MaximumSubArray1.cs
https://github.com/jianminchen/Leetcode_C-/blob/master/53MaximumSubArray2.cs

http://juliachencoding.blogspot.ca/2015/07/dp-problem-kadanes-algorithm-maximum.html

13. Leetcode 352 - Data Stream as Disjoint Intervals  (Hard - 34% passing rate)
http://www.cnblogs.com/grandyang/p/5548284.html

14. Leetcode 174 Dungeon game



15. Leetcode 247 H-index



16. Leetcode 269 Alien dictionary

17. Leetcode 142 Linked List Cycle II

17B. Leetcode 286 Walls and Gates

18. Leetcode 329 Longest increasing path in matrix
19. Leetcode 345 Reverse Vowels of a string
20. Leetcode 354 Russian Doll Envelopes

Flatten Linked List
http://www.geeksforgeeks.org/flattening-a-linked-list/

Blogs: Learn system design:
https://www.quora.com/How-should-I-prepare-for-my-Google-interview-if-I-have-1-month-left

80 questions to think about:
https://www.educative.io/collection/5642554087309312/5679846214598656

有O(N*M)的算法,思路是转换成直方图然后维护一个栈。
一个矩阵里,里面元素是0或者1,要你找一个面积最大的全1的子矩阵。
如果不要求是矩形只要求是一块任意形状的区域的话,可以使用FloodFill,O(N*M). 然后这里是矩阵,然后我们转换。
brute force:
枚举左上和右下两个点,然后判断是否全1,这样是 O(N*N*M*M)的算法,因为判断是否全1可以用sum数组来减一下,O(1)就够了。
(detail discussion: https://zhuanlan.zhihu.com/p/19873823?refer=qinchao)
http://poj.org/problem?id=3494
FloodFill
https://en.wikipedia.org/wiki/Flood_fill


blog:
Leetcode 269
C++ solution:
http://www.cnblogs.com/jcliBlogger/p/4758761.html

Discussion about the problem description:
https://leetcode.com/discuss/53997/the-description-is-wrong

C++ solution:

https://leetcode.com/discuss/54024/straightforward-c-solution?show=54024#q54024


Java solution to study:

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/269.alien-dictionary.java

http://www.cnblogs.com/yrbbest/p/5023584.html

study C# code:
https://gist.github.com/jianminchen/07546625d828f63e762ba03b463fe8aa

Leetcode 329:
http://gaocegege.com/Blog/algorithm/leetcode329

http://blog.csdn.net/sbitswc/article/details/50707203

http://basics.sjtu.edu.cn/~xiaojuan/algo16/

June 20, C# practice:
https://gist.github.com/jianminchen/b984ccba8dabbb0bb78160c6e5c6e8b4

No comments:

Post a Comment