|  | 
| 9 | 9 | | 1 | [Two Sum](https://leetcode.com/problems/two-sum/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/001_Two_Sum.py) | 1. Hash O(n) and O(n) space<br>2. Sort and search with two points O(n) and O(1) space | | 
| 10 | 10 | | 2 | [Add Two Numbers](https://leetcode.com/problems/add-two-numbers/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/002_Add_Two_Numbers.py) | Note the carry from lower digit. | | 
| 11 | 11 | | 3 | [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/003_Longest_Substring_Without_Repeating_Characters.py) |1. Check every possible substring O(n^2) <br>2. Remember the character index and current check pos, if character index >= current pos, then there is duplicate | | 
| 12 |  | -| 4 | [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/.py) | 1. Merge two sorted lists and compute median, O(m + n) and O(m + n)<br>2. An extension of median of two sorted arrays of equal size problem| | 
|  | 12 | +| 4 | [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/004_Median_of_Two_Sorted_Arrays.py) | 1. Merge two sorted lists and compute median, O(m + n) and O(m + n)<br>2. An extension of median of two sorted arrays of equal size problem| | 
| 13 | 13 | | 5 | [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/005_Longest_Palindromic_Substring.py) | [Background knowledge](http://en.wikipedia.org/wiki/Longest_palindromic_substring)<br>1. DP if s[i]==s[j] and P[i+1, j-1] then P[i,j]<br>2. A palindrome can be expanded from its center<br>3. Manacher algorithm| | 
| 14 | 14 | | 7 | [Reverse Integer](https://leetcode.com/problems/reverse-integer/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/007_Reverse_Integer.py) | Overflow when the result is greater than 2147483647 | 
| 15 | 15 | | 8 | [String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/008_String_to_Integer(atoi).py) | Overflow, Space, and negative number | | 
|  | 
| 51 | 51 | | 136 | [Single Number](https://leetcode.com/problems/single-number/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/136_Single_Number.py) | 1. Hash or set, O(n) and O(n)<br>2. xor O(n) and O(1) | | 
| 52 | 52 | | 137 | [Single Number II](https://leetcode.com/problems/single-number-ii/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/137_Single_Number_II.py) | 1. ctypes 32 % 3 and &, O(n) and O(1)<br>2. ones, twos, threes as bitmask (e.g. ones represents ith bit had appeared once), O(n) and O(1) |  | 
| 53 | 53 | | 138 | [Copy List with Random Pointer](https://leetcode.com/problems/copy-list-with-random-pointer/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/138_Copy_List_with_Random_Pointer.py) | 1. Hash O(n) and O(n)<br>2.  Modify original structure: Original->Copy->Original, then node.next.random = node.random.next, O(n) and O(1) | | 
| 54 |  | -| 141 | [Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/.py) | 1. Hash or set<br> 2. Two points (fast and slow)<br>3. Add a max and check if reach the max | | 
|  | 54 | +| 141 | [Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/141_Linked_List_Cycle.py) | 1. Hash or set<br> 2. Two points (fast and slow)<br>3. Add a max and check if reach the max | | 
| 55 | 55 | | 142 | [Linked List Cycle II](https://discuss.leetcode.com/topic/2975/o-n-solution-by-using-two-pointers-without-change-anything) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/142_Linked_List_Cycle_II.py) | Two points, a+b=nr | | 
| 56 | 56 | | 143 | [Reorder List](https://leetcode.com/problems/reorder-list/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/143_Reorder_List.py) | 1. List as index to rebuild relation, O(n) and O(n)<br>2. Two points, O(n) and O(1) | | 
| 57 | 57 | | 144 | [Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/144_Binary_Tree_Preorder_Traversal.py) | 1. Recursion, O(n) and O(n)<br>2. Stack, O(n) and O(n) | | 
|  | 
| 92 | 92 | | 339 | [Nested List Weight Sum](https://leetcode.com/problems/nested-list-weight-sum/) ♥ | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/339_Nested_List_Weight_Sum.py) | Depth-first recursion | | 
| 93 | 93 | | 340 | [Longest Substring with At Most K Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/) ♥ | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/340_Longest_Substring_with_At_Most_K_Distinct_Characters.py) | Maintain a sliding window with at most k distinct characters and a count for this window. Note that the start position need a loop to update.| | 
| 94 | 94 | | 351 | [Android Unlock Patterns](https://leetcode.com/problems/android-unlock-patterns/) ♥ | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/351_Android_Unlock_Patterns.py) |  | | 
|  | 95 | +| 368 | [Largest Divisible Subset](https://leetcode.com/problems/largest-divisible-subset/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/368_Largest_Divisible_Subset.py) | Sort and generate x subset with previous results, O(n^2) and O(n^2) | | 
| 95 | 96 | | 384 | [Shuffle an Array](https://leetcode.com/problems/shuffle-an-array/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/384_Shuffle_an_Array.py) | Fisher–Yates shuffle, O(n) and O(n) | | 
| 96 | 97 | | 388 | [Longest Absolute File Path](https://leetcode.com/problems/longest-absolute-file-path/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/388_Longest_Absolute_File_Path.py) | Store last length and rindex, O(n) and O(n) | | 
| 97 |  | - | 
|  | 98 | +| 416 | [Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/) | [Python](https://github.com/qiyuangong/leetcode/blob/master/python/416_Partition_Equal_Subset_Sum.py) | DP, Check if sum of some elements can be half of total sum, O(total_sum / 2 * n) and O(total_sum / 2) | | 
| 98 | 99 | 
 | 
| 99 | 100 | | # | To Understand | | 
| 100 | 101 | |---| ----- | | 
|  | 
0 commit comments