Saturday, August 22, 2015

Leetcode questions 11 - 20

August 22, 2015


11 Container with Most water
blog:
http://www.cnblogs.com/TenosDoIt/p/3812880.html

C#:
https://github.com/jianminchen/Leetcode_C-/blob/master/11ContainerWithMostWater.cs

12. Integer to Roman


13 Roman to Integer

https://github.com/jianminchen/Leetcode_C-/blob/master/13RomanToInteger.cs

14. LOngest Common Prefix

https://github.com/jianminchen/Leetcode_C-/blob/master/LongestCommonPrefix_No14.cs

15. 3Sum

16 3 Sum Closest

https://github.com/jianminchen/Leetcode_C-/blob/master/3sumCloset.cs

17 Letter Combinations of a phone number (DFS)

http://www.cnblogs.com/grandyang/p/4452220.html
Analysis from the above blog:
这道题让我们求电话号码的字母组合,即数字2到9中每个数字可以代表若干个字母,然后给一串数字,求出所有可能的组合,相类似的题目有 Path Sum II 二叉树路径之和之二Subsets II 子集合之二Permutations 全排列Permutations II 全排列之二Combinations 组合项 Combination Sum 组合之和 Combination Sum II 组合之和之二等等。我们用递归Recursion来解,我们需要建立一个字典,用来保存每个数字所代表的字符串,然后我们还需要一个变量level,记录当前生成的字符串的字符个数,实现套路和上述那些题十分类似,

https://github.com/jianminchen/Leetcode_C-/blob/master/LetterCombinationOfAPhoneNumber.cs

18 4 sum

19 Remove Nth Node From End of List

20 Valid Parentheses

http://blog.csdn.net/fightforyourdream/article/details/13011825

C# code:
https://github.com/jianminchen/Leetcode_C-/blob/master/20ValidParentheses.cs
January 20, 2016
https://github.com/jianminchen/Leetcode_C-/blob/master/20ValidParentheses_B.cs

favorite blogs to read: January 20, 2016
http://bangbingsyb.blogspot.ca/2014/11/leetcode-valid-parentheses.html

http://www.acmerblog.com/leetcode-solution-valid-parentheses-6316.html

http://blog.csdn.net/foreverling/article/details/49685177?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io

http://segmentfault.com/a/1190000003481208

http://harrifeng.github.io/algo/leetcode/valid-parentheses.html

http://www.jiuzhang.com/solutions/valid-parentheses/

So, ready to work on the next algorithm about parentheses:
Leetcode 32: longest valid parentheses -
http://codeganker.blogspot.ca/2014/03/longest-valid-parentheses-leetcode.html


No comments:

Post a Comment