You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -154,6 +154,7 @@ Also, there are open source implementations for basic data structs and algorithm
154
154
| 475 |[Heaters](https://leetcode.com/problems/heaters/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/475_Heaters.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/475_Heaters.java)| 1. Binary search hourse in heater array, O(nlogn) and O(1)<br> 2. Two points, O(nlogn) and O(1) |
155
155
| 479 |[Largest Palindrome Product](https://leetcode.com/problems/largest-palindrome-product/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/479_Largest_Palindrome_Product.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/479_Largest_Palindrome_Product.java)| 1. Product max palindrome than check, O(n^2) and O(1)<br>2. [Math](# https://leetcode.com/problems/largest-palindrome-product/discuss/96305/Python-Solution-Using-Math-In-48ms)|
156
156
| 482 |[License Key Formatting](https://leetcode.com/problems/license-key-formatting/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/482_License_Key_Formatting.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/482_License_Key_Formatting.java)| String processing, lower and len % K, O(n) and O(n) |
157
+
| 509 |[Fibonacci Number](https://leetcode.com/problems/fibonacci-number/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/509_Fibonacci_Number.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/509_Fibonacci_Number.java)| 1. Recursive, O(n) <br>2. DP with memo, O(n). Note that N<=30, which means that we can keep a memo from 0 to 30. |
157
158
| 538 |[Convert BST to Greater Tree](https://leetcode.com/problems/convert-bst-to-greater-tree/description/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/538_Convert_BST_to_Greater_Tree.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/538_Convert_BST_to_Greater_Tree.java)| Right first DFS with a variable recording sum of node.val and right.val. 1. Recursive.<br>2. Stack 3. Reverse Morris In-order Traversal |
158
159
| 543 |[Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree/description/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/543_Diameter_of_Binary_Tree.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/543_Diameter_of_Binary_Tree.java)| DFS with O(1) for max answer |
159
160
| 547 |[Friend Circles](https://leetcode.com/problems/friend-circles/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/547_Friend_Circles.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/547_Friend_Circles.java)| 1. DFS, O(n^2) and O(1)<br>2. BFS, O(n^2) and O(1)<br>3. Union-find, O(n^2) and O(n)|
@@ -205,7 +206,7 @@ Also, there are open source implementations for basic data structs and algorithm
205
206
| 953 |[Verifying an Alien Dictionary](https://leetcode.com/contest/weekly-contest-114/problems/verifying-an-alien-dictionary/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/953_Verifying_an_Alien_Dictionary.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/953_Verifying_an_Alien_Dictionary.java)| Use hashmap to store index of each value, then create a comparator based on this index, O(n) and O(n) |
206
207
| 954 |[Array of Doubled Pairs](https://leetcode.com/contest/weekly-contest-114/problems/array-of-doubled-pairs/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/954_Array_of_Doubled_Pairs.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/954_Array_of_Doubled_Pairs.java)| Sort, then use hashmap to store the frequency of each value. Then, check n, 2 * n in hashmap, O(nlogn) and O(n) |
207
208
| 961 |[N-Repeated Element in Size 2N Array](https://leetcode.com/problems/n-repeated-element-in-size-2n-array/submissions/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/961_N-Repeated_Element_in_Size_2N_Array.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/961_N-Repeated_Element_in_Size_2N_Array.java)| Hash and count number, O(n) and O(n) |
208
-
| 962 |[Maximum Width Ramp](https://leetcode.com/problems/maximum-width-ramp/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/962_Maximum_Width_Ramp.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/962_Maximum_Width_Ramp.java)| 1. Sort index by value, then transfer problem into finding max gap between index, O(nlogn) and O(1)<br> |
209
+
| 962 |[Maximum Width Ramp](https://leetcode.com/problems/maximum-width-ramp/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/962_Maximum_Width_Ramp.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/962_Maximum_Width_Ramp.java)| 1. Sort index by value, then transfer problem into finding max gap between index, O(nlogn) and O(1)<br>2. Binary Search for candicates, O(nlogn) and O(n)|
0 commit comments