@@ -15,7 +15,7 @@ Solve problems in LeetCode http://oj.leetcode.com/.
1515
1616 Use long long to make sure the string can be converted, then check whether it exceeds INT_MAX/INT_MIN.
1717
18- 3 . 3 Sum
18+ ** 3. 3 Sum**
1919
2020 Size of vector >= 3
2121
@@ -31,7 +31,7 @@ Solve problems in LeetCode http://oj.leetcode.com/.
3131
3232 Use a dummy node, link the next to the new Listnode with the smaller value, then return dummy->next.
3333
34- 6 . Implement strStr()
34+ ** 6. Implement strStr()**
3535
3636 Use char* directly to compare.
3737
@@ -51,15 +51,15 @@ Solve problems in LeetCode http://oj.leetcode.com/.
5151
5252 Two pointers, one faster, one slow, then meet together or meet NULL.
5353
54- 10 . Insert Interval
54+ ** 10. Insert Interval**
5555
5656 Usefull of vector insert() and erase().
5757
5858 Insert: inserting new elements before the element at the specified position.
5959
6060 Erase return value: An iterator pointing to the new location of the element that followed the last element erased by the function call.
6161
62- 11 . Valid Number
62+ ** 11. Valid Number**
6363
6464 Too many different cases to handle.
6565
@@ -89,11 +89,11 @@ Solve problems in LeetCode http://oj.leetcode.com/.
8989
9090 Recursive Problem. Left nodes should locate in [min, parent->val], right nodes should locate in [parent->val, max].
9191
92- 16 . Valid Palindrome
92+ ** 16. Valid Palindrome**
9393
9494 isalnum(c): Checks whether c is either a decimal digit or an uppercase or lowercase letter.
9595
96- 17 . Word Ladder
96+ ** 17. Word Ladder**
9797
9898 Graph BFS problem. Use a queue and a visited array for BFS without constructing the graph.
9999
@@ -103,7 +103,7 @@ Solve problems in LeetCode http://oj.leetcode.com/.
103103
104104 Stop condition: while(l1 || l2 || carry)
105105
106- 19 . Integer to Roman
106+ ** 19. Integer to Roman**
107107
108108 Left(-) and right(+) for 5s and 10s.
109109
@@ -121,7 +121,7 @@ Solve problems in LeetCode http://oj.leetcode.com/.
121121
122122 Make sure number of left parentheses is not smaller than number of right parentheses.
123123
124- 23 . Merge k Sorted Lists
124+ ** 23. Merge k Sorted Lists**
125125
126126 Call the Merge Tow Sorted Lists k times, you are done!
127127
@@ -150,10 +150,30 @@ Solve problems in LeetCode http://oj.leetcode.com/.
150150
151151 Similar to Add Two Numbers. Use string instead of linked list.
152152
153- 29 . Sqrt(x)
153+ ** 29. Sqrt(x)**
154154
155155 Binary search method. Be careful about overflow, using long long.
156156
15715730 . Combinations
158158
159159 DFS. In position k, iterative through k+1 to n.
160+
161+ 31 . Subsets
162+
163+ DFS. Similar to Combinations, but stores all subsets into result.
164+
165+ ** 32. Word Search**
166+
167+ DFS. If current char match the word, traversal its four directions. Use a visited[][] to mark visited or not.
168+
169+ Put the check into a function for a better structure of code.
170+
171+ ** 33. Decode Ways**
172+
173+ Dynamic problem. Similar to Climbing Stairs, with some limitations.
174+
175+ dp[i] = dp[i-1] + dp[i-2], add dp[i-2] if two char can be put together.
176+ 34 . Binary Tree Level Order Traversal
177+
178+ Use a queue to store the children nodes of current level.
179+
0 commit comments