LeetCode exercises by Python and C++
Index | Title | Solution | Idea |
---|---|---|---|
144 | preorder traversal | python C++ |
|
94 | inorder traversal | python C++ |
|
145 | postorder traversal | python C++ |
|
102 | level order traversal | python C++ |
|
107 | level order traversal 2 | python | |
104 | maximum depth of binary tree | python C++ |
TopToBottom BottomToTop BFS DFS |
101 | symmetric tree | python C++ |
|
112 | path sum | python C++ |
|
98 | validate binary search tree | python C++ |
|
108 | convert sorted array to binary search tree | python C++ |
|
226 | invert binary tree | python C++ |
|
105 | construct binary tree from preorder and inorder traversal | python C++ |
|
106 | construct binary tree from inorder and postorder traversal | python C++ |
|
116 | populating next right pointers in each node | python C++ |
|
117 | populating next right pointers in each node ii | python C++ |
|
297 | serialize and deserialize binary tree | python C++ |
Index | Title | Solution | Idea |
---|---|---|---|
724 | find pivot index | python C++ |
|
35 | search insert position | python C++ |
|
56 | merge intervals | python C++ |
|
118 | pascals triangle | python C++ |
|
119 | pascals triangle ii | python C++ |
|
209 | minimum size subarray sum | python C++ |
Index | Title | Solution | Idea |
---|---|---|---|
48 | rotate image | python C++ |
flip diagonally then horizontally |
73 | set matrix zeroes | python C++ |
remember position smart |
88 | merge sorted array | python C++ |
remember position smart |
498 | diagonal traverse | python C++ |
Index | Title | Solution | Idea |
---|---|---|---|
5 | longest palindromic substring | python C++ |
|
14 | longest common prefix | python C++ |
|
28 | strStr | python C++ |
KMP |
557 | reverse words in a string iii | python C++ |
Index | Title | Solution | Idea |
---|---|---|---|
344 | reverse string | python C++ |
|
561 | array partition i | python C++ |
|
167 | two sum ii input array is sorted | python C++ |
|
27 | remove element | python C++ |
|
485 | max consecutive ones | python C++ |
|
26 | remove duplicates from sorted array | python C++ |
|
283 | move zeros | python C++ |
Index | Title | Solution | Idea |
---|---|---|---|
35 | search insert position | python C++ |
|
153 | find minimum in rotated sorted array | python C++ |
|
278 | first bad version | python C++ |
Index | Title | Solution | Idea |
---|---|---|---|
19 | remove nth node from end of list | python |
|
21 | merge two sorted lists | python |
|
141 | linked list cycle | python |
|
206 | reverse linked list | python |
|
234 | palindrome linked list | python |
|
237 | delete node in a linked list | python |