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-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -112,7 +112,7 @@ Also, there are open source implementations for basic data structs and algorithm
112
112
| 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 |
113
113
| 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.|
114
114
| 346 |[Moving Average from Data Stream](https://leetcode.com/problems/moving-average-from-data-stream/)♥|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/346_Moving_Average_from_Data_Stream.py)| fix-sized queue or dequeue, O(1) and O(n) |
115
-
| 347 |[Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/347_Top_K_Frequent_Elements.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/347_Top_K_Frequent_Elements.java)| Sort by frequency, O(nlogn) and O(n). |
115
+
| 347 |[Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/347_Top_K_Frequent_Elements.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/347_Top_K_Frequent_Elements.java)|1. Sort by frequency, O(nlogn) and O(n). <br> 2. we can build a min heaq (based on frequency), then pop min until there are k element, O(klgn) and O(n)|
116
116
| 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)| Backtracking, O(n!) and O(n) |
117
117
| 359 |[Logger Rate Limiter](https://leetcode.com/problems/logger-rate-limiter/)♥|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/359_Logger_Rate_Limiter.py)| 1. hash which stores the latest timestamp, O(1) and O(n)<br>2. Using Priority queue to remove older logs, O(n) and O(n) |
118
118
| 366 |[Find Leaves of Binary Tree](https://leetcode.com/problems/find-leaves-of-binary-tree/)♥|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/366_Find_Leaves_of_Binary_Tree.py)| 1. Set or hash to check leaft, O(n^2) and O(n)<br>2. Recursively check level and return them, O(n) and O(n)|
@@ -152,6 +152,7 @@ Also, there are open source implementations for basic data structs and algorithm
152
152
| 617 |[Merge Two Binary Trees](https://leetcode.com/problems/merge-two-binary-trees/description/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/617_Merge_Two_Binary_Trees.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/617_Merge_Two_Binary_Trees.java)| Traverse both trees Recursion & Iterative (stack) |
| 697 |[Degree of an Array](https://leetcode.com/problems/degree-of-an-array/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/697_Degree_of_an_Array.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/697_Degree_of_an_Array.java)| 1. Find degree and value, then find smallest subarray (start and end with this value), O(n) and O(n)<br>2. Go through nums, remember left most pos and right most for each value, O(n) and O(n) |
155
+
| 703 |[Kth Largest Element in a Stream](https://leetcode.com/problems/kth-largest-element-in-a-stream/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/703_Kth_Largest_Element_in_a_Stream.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/703_Kth_Largest_Element_in_a_Stream.java)| 1. Sort and insert into right place, O(nlgn) and O(n)<br>2. k largest heap, O(klgn) and O(n) |
155
156
| 706 |[Design HashMap](https://leetcode.com/problems/design-hashmap/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/706_Design_HashMap.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/706_Design_HashMap.java)| Hash implementation, mod is fine. Be careful about key conflict and key remove. |
156
157
| 709 |[To Lower Case](https://leetcode.com/problems/to-lower-case/)|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/709_To_Lower_Case.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/709_To_Lower_Case.java)| String processing:<br>1. str.lower() or str.toLowerCase()<br>2. ASCII processing. O(n) and O(1) |
157
158
| 716 |[Max Stack](https://leetcode.com/problems/max-stack/)♥|[Python](https://github.com/qiyuangong/leetcode/blob/master/python/716_Max_Stack.py)[Java](https://github.com/qiyuangong/leetcode/blob/master/java/716_Max_Stack.java)| 1. Two stacks<br> 2. Double linked list and Hash |
0 commit comments