Friday, August 21, 2015

Leetcode questions from 61 - 69

August 21, 2015

Speed up study leetcode questions, 10 question a time, in 2-3 hours. And see if I can learn something quickly.

61 Rotate List

62 Unique Paths



DP algorithm in detail, time complexity and space complexity analysis is great in the following blog:





63 Unique Paths II

64 Minimum Path Sum

discussion of using 2 dimension array or using one dimension array, still not clear.

understand this blog on DP solutions, one is space O(n^2), one is space O(n).


65 Valid number

ideas for the solution from the following blog: 
3 flags are set: num, exp, dot, and then,
1. if there is e flag, then there is a digit before e flag, cannot have any e.
Also, there is a digit followed.
2. if . shows up, then it is a small fraction number, so neither . nor e is before .
3. if +, -, then it must be first one, or the previous on is e,
for example: "005047e+6".
The above summary is from the following blog:

code is here:



66 Plus number

67 Add Binary

Totally forget I did this implementation. So, I have to learn everything about this problem again, read more blogs this time.

https://github.com/jianminchen/addBinary/blob/master/Program.cs

my favorite solution is the following blog:
http://fisherlei.blogspot.ca/2013/01/leetcode-add-binary.html

julia's C# code:
https://github.com/jianminchen/Leetcode_C-/blob/master/67AddBinary2.cs

http://bangbingsyb.blogspot.ca/2014/11/leetcode-add-binary.html

the code should be more short, but the discussion and idea in the code is very clear.
http://siddontang.gitbooks.io/leetcode-solution/content/string/add_binary.html

Good quality code, try it myself later.
http://www.jiuzhang.com/solutions/add-binary/

julia's c# implementation:
https://github.com/jianminchen/Leetcode_C-/blob/master/67AddBinary.cs



68 Text Justification


70 Climbing Stairs

http://juliachencoding.blogspot.ca/2015/07/leetcode-climbing-stairs.html


No comments:

Post a Comment