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
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,7 @@ I'm currently working on [Analytics-Zoo](https://github.com/intel-analytics/anal
133
133
| 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) |
134
134
| 369 |[Plus One Linked List](https://leetcode.com/problems/plus-one-linked-list/)♥|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/369_Plus_One_Linked_List.py)| 1. Stack or list that store the list, O(n) and O(n)<br>2. Two points, the first to the tail, the second to the latest place that is not 9, O(n) and O(1) |
135
135
| 370 |[Range Addition](https://leetcode.com/problems/range-addition/)♥|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/370_Range_Addition.py)| Interval problem with cumulative sums, O(n + k) and O(n) |
136
+
| 380 |[Insert, Delete, Get Random](https://leetcode.com/problems/insert-delete-getrandom-o1/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/380_Insert_Delete_GetRandom.py)| Uses both a list of nums and a list of their locations |
136
137
| 383 |[Ransom Note](https://leetcode.com/problems/ransom-note/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/383_Ransom_Note.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/383_Ransom_Note.java)| Get letter frequency (table or hash map) of magazine, then check randomNote frequency |
137
138
| 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](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle), O(n) and O(n) |
138
139
| 387 |[First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/387_First_Unique_Character_in_a_String.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/387_First_Unique_Character_in_a_String.java)| Get frequency of each letter, return first letter with frequency 1, O(n) and O(1) |
@@ -153,6 +154,7 @@ I'm currently working on [Analytics-Zoo](https://github.com/intel-analytics/anal
153
154
| 434 |[Number of Segments in a String](https://leetcode.com/problems/number-of-segments-in-a-string/description/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/434_Number_of_Segments_in_a_String.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/434_Number_of_Segments_in_a_String.java)| 1. trim &split<br>2. Find segment in place |
154
155
| 437 |[Path Sum III](https://leetcode.com/problems/path-sum-iii/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/437_Path_Sum_III.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/437_Path_Sum_III.java)| 1. Recursively travese the whole tree, O(n^2)<br>2. Cache sum in Hash based on solution 1. Note that if sum(A->B)=target, then sum(root->a)-sum(root-b)=target.|
155
156
| 438 |[Find All Anagrams in a String](https://leetcode.com/problems/find-all-anagrams-in-a-string/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/438_Find_All_Anagrams_in_a_String.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/438_Find_All_Anagrams_in_a_String.java)| Build a char count list with 26-256 length. Note that this list can be update when going through the string. O(n) and O(1) |
| 443 |[String Compression](https://leetcode.com/problems/string-compression/description/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/443_String_Compression.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/443_String_Compression.java)| Maintain curr, read, write and anchor (start of this char). |
157
159
| 448 |[Find All Numbers Disappeared in an Array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/448_Find_All_Numbers_Disappeared_in_an_Array.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/448_Find_All_Numbers_Disappeared_in_an_Array.java)| Value (1, n) and index (0, n-1). Mark every value postion as negative. Then, the remain index with positive values are result. O(n)|
158
160
| 453 |[Number of Segments in a String](https://leetcode.com/problems/minimum-moves-to-equal-array-elements/description/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/453_Minimum_Moves_to_Equal_Array_Elements.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/453_Minimum_Moves_to_Equal_Array_Elements.java)| Each move is equal to minus one element in array, so the answer is the sum of all elements after minus min. |
@@ -225,6 +227,7 @@ I'm currently working on [Analytics-Zoo](https://github.com/intel-analytics/anal
225
227
| 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) |
226
228
| 977 |[Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/977_Squares_of_a_Sorted_Array.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/977_Squares_of_a_Sorted_Array.java)| 1. Sort, O(nlogn) and O(n)<br>2. Two point, O(n) and O(n) |
227
229
| 973 |[K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/973_K_Closest_Points_to_Origin.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/973_K_Closest_Points_to_Origin.java)| 1. Sort and get 0-K, O(nlogn) and O(1)<br>2. Min Heap, O(nlogk) and O(k) |
230
+
| 981 |[Time Based Key-Value Store](https://leetcode.com/problems/time-based-key-value-store/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/981_Time_Based_Store.py)| Get: O(log(n)) time<br>Set: O(1) time |
228
231
| 1064 |[Fixed Point](https://leetcode.com/problems/fixed-point/)♥|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/1064_Fixed_Point.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/1064_Fixed_Point.java)| 1. Go through index and value, until find solution encounter index < value, O(n) and O(1)<br>2. Binary search, O(logn) and O(1) |
229
232
| 1089 |[Duplicate Zeros](https://leetcode.com/problems/duplicate-zeros/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/1089_Duplicate_Zeros.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/1089_Duplicate_Zeros.java)| 2 Pass, store last position and final move steps, O(n) and O(1) |
230
233
| 1108 |[Defanging an IP Address](https://leetcode.com/problems/defanging-an-ip-address/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/1108_Defanging_an_IP_Address.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/1108_Defanging_an_IP_Address.java)| String manipulate (split, replace and join), O(n) and O(n) |
0 commit comments