- 1229. Meeting Scheduler(Medium). Two pointers and scan line. Pretty easy.
- 986. Interval List Intersections (Medium). Similar as 1229 using two pointers and scan line. Pretty easy.
- 759. Employee Free Time (Hard). Scan Line, deque, use an maxEnd varable
- 560. Subarray Sum Equals K (Medium). Four methods. Prefix sum. Hashmap for storing sum values to look up like two sum.
- 218. The Skyline Problem (Hard). Python max heap hard to use, and no remove function, so used SortedList from sortedcontainers.
- 111. Minimum Depth of Binary Tree (Easy). Two methods, 1. recursion DFS. 2. queue BFS.
- 102. Binary Tree Level Order Traversal (Medium). 2 method. 1. recursion DFS. 2.queue BFS.
- 127. Word Ladder(Hard). 2 method. 1. one direction BFS. 2. 2 direction BFS.
- 490. The Maze (Hard). Brute force BFS.
- 505. The Maze II (Medium). Dijkstra's algorithm
- 283. Move Zeroes (Easy). Two pointers methods. Need review!!!
- 811. Subdomain Visit Count (Medium). defaultdict and split method.
- 207. Course Schedule (Medium). Use defaultdict and a list to store the graph. Use heap to perform BFS.
- 724. Find Pivot Index (Esay). Two methods. 1. One pointer to adjust left and right sum. 2. Use prefix sum.
- 210. Course Schedule II (Medium). Similar as 207 Course Schedule.
- 278. First Bad Version (Esay). Two methods. 1. returns left or right. 2. use a variable to record ans.
- 4. Median of Two Sorted Arrays (Hard). Binary Search on one array only and use it for the second array with some constrains.
- 704. Binary Search (Easy). Template binary search problem.
- 34. First and Last in Sorted Array (Medium). Find the left boundary and right boundary (first occurance and last occurance).
- 33. Search in Rotated Sorted Array (Medium). Determine which part is in order.
- 702. Search in a Sorted Array of Unknown Size (Medium). Find the right bound first and then binary search.
- 74. Search a 2D Matrix (Medium). Basic binary search template.
- 35. Search Insert Position (Easy). Basic binary search template.
- 162. Find Peak Element (Medium). Binary search template. using left + 1 < right is better.
- 69. Sqrt(x) (Easy).
- 287. Find the Duplicate Number (Medium). Use binary search in a spefic range.
- 875. Koko Eating Bananas (Medium) Use binary search. Needs to determine the range and target conditions.
- 1011. Capacity To Ship Packages Within D Days (Medium). Binary search with special range, similar to Koko eating banana.
- 528. Random Pick with Weight (Medium). Binary search with prefix sum. random a sum, and find the interval.
- Redo 4. Median of Two Sorted Arrays (Hard). Spent 1h but still cant finish debuging, always array out of bound.
- 1060. Missing Element in Sorted Array (Medium). Binary search on comparing missing bumbers with k.
- 415. Add Strings (Easy). two pointers for string. Using while loop for two pointer questions.
- 11. Container With Most Water(Medium). two pointers and calculate the area.
- 2. Add Two Numbers (Medium). Two pointers and a carry.
- 912. Sort an Array (Medium). Two sorting method, quick sort and merge sort.
- 1. Two Sum (Easy). A hash table, key: num, value: index.
- 167. Two Sum II - Input array is sorted (Easy). Two pointers from begin and end.
- 15. 3Sum (medium). Two pointers or hash map
- 49. Group Anagrams (Medium). Hashmap/defaultdict with keys being strings and values being lists.
- 75. Sort Colors (Mdeium). Use 3 pionters: two fixed pointers, l and r, on both side for representing 0 and 2. One floating pinter m in the middle.
- 445. Add Two Numbers II (Medium). Two pointers with a carry. Reversing a linked list.
- 206. Reverse Linked List (Easy). 1). Two pointers: cur and prev. 2). Recursion: fixed the first pointer and recursive reverse the latter ones.
- 345. Reverse Vowels of a String (Easy). two pointers. Change string to list using list('abc').
- [560 Subarray Sum Equals K (Medium)]. Second time.
- 974. Subarray Sums Divisible by K (Medium). 1). Use 2 prefix sum and a hashtable/dict {prefix sum % k: count} and then same as two sum. 2). need to consider the reminder of negitive value, so (reminder + k) to transfer it to positive. 3). Set dict[0] = 1.
- 26. Remove Duplicates from Sorted Array (Medium). Two pionters both start from the left.
- 80. Remove Duplicates from Sorted Array II (Medium). [Tricky, review again.] Use two pointers one fixed pointer(l) and one floating(r).
- [283. Move Zeroes (Easy)]. Second time.
- 3. Longest Substring Without Repeating Characters (Medium). 1). Two pointers, sliding windows, set/hashset. 2). Need to check clearfully when running examples
- 209. Minimum Size Subarray Sum (Medium). Positive integers so can use two pointers/sliding window. Can we use hashmap?
- 438. Find All Anagrams in a String (Medium). Use a sliding window and hashtable/dict for all lowercase chars. Compare two tables/dicts.
- 227. Basic Calculator II (Medium). Use a stack to push numbers and do operations when meet previous operator.
- 224. Basic Calculator (Hard). 1). Use sum and sign to store the current sum and previous sign. 2). use while loop to go though all digit of a number. 3). When '(' append, when ')' pop.
- 349. Intersection of Two Arrays (Easy) Use 2 sets or a binary search.
- 350. Intersection of Two Arrays II (Easy). 2 methods, Hash table or sort. 3 follow ups.
- 239. Sliding Window Maximum (Hard) Use a deque for storing numbers in decreasing order. When first number is out of range, pop. The ans is the first number in the deque.
- 42. Trapping Rain Water (Hard) Use two opposite directional pointers to calculate max height for each direction. Use min of (max_left, max_right) - height for water difference at each location
- [102. Binary Tree Level Order Traversal (Medium)] Second time.
- 56. Merge Intervals (Medium). Second time. Sort and list. Don't forgot corner cases.
- 200. Number of Islands (Medium). Second time. BFS and deque.
- 236. Lowest Common Ancestor of a Binary Tree. Return the node if found and pass it up.
- 235. Lowest Common Ancestor of a Binary Search Tree (Medium). Compare values and go left or right. Improve the order of if else makes code better.
- 28. Implement strStr() (Easy). Use string equal. Be careful on for loop conditions.
- 103. Binary Tree Zigzag Level Order Traversal (Medium). Same way of using queue, but append to result using different order.
- 557. Reverse Words in a String III (Easy). Reverse a string using deque and append all sapces.
- 199. Binary Tree Right Side View (Medium). Level order traversal and store the last element.
- 695. Max Area of Island (Medium). BFS. Similar to number of islands.
- 263. Ugly Number(Easy) Devide all prime numbers if divisible, and return n == 1.
- 1041. Robot Bounded In Circle (Medium). Two conditions: 1). Return to origin after one iter. 2). Location changed and direction also changed at the end of one iter. Also need to change dir when turns.
- 221. Maximal Square (Medium). Use an hash map/ dict for the max area/lenth for each cell. Check right, down and corner to see if it can be a square. Recursively check the lenth of the adjusent squere and add them to the dict.
- 78. Subsets (Medium). Combination algorithm, DFS. For loop for different the length of the sub_set. dfs(lenth, start_number, cur_set)
- 90. Subsets II (Medium). Simiar to 78. Subsets, just need to sort the input and skip repeated numbers.
- 1091. Shortest Path in Binary Matrix (Medium). BFS Graph shortest path.
- 190. Reverse Bits (easy). Use n >> i & 1 to get a bit value at i.
- 542. 01 Matrix (Medium). Has multiple targets, use all of them as starting point to be more efficient.
- 98. Validate Binary Search Tree (Medium). Top down recursion or in-order traversal.
- 6. ZigZag Conversion (Medium). String. For loop if there is a fixed increment.
- 55. Jump Game (Medium). Question. Greedy, backward.
- 286. Walls and Gates (Medium). Quesiton. Use multiple targets as starting points and add to queue. Use a function to check valid and add node to queue. Check BFS INDEX x_new and y_new.
- 210. Course Schedule II (Medium). 2nd, BFS.
- 39. Combination Sum (Medium). Sort list first. Use DFS for combination problem.
- 46. Permutations (Medium). DFS for permutation problems.
- 47. Permutations II (Medium). DFS for permutation problems.
- 78. Subsets (Medium). Second time.
- 77. Combinations (Medium). DFS for combinations.
- 40. Combination Sum II (Medium). Don't forgot to use early termination for DFS.
- 90. Subsets II (Medium). Second Time.
- 17. Letter Combinations of a Phone Number (Medium). Tricky! Do again! Levels (index) choose from digits('23'), so index will be +1 for next level, not letters. Within each level, choose from letters 'abc', 'def'.
- 110. Balanced Binary Tree (Easy). When doing divide and conquer, thinking about return value of DFS, no need for global variables.