Array
Types of questions
Find peak (not ordered)
Find rang of something
File | confidence | date | difficulty | note |
---|---|---|---|---|
33. Search in Rotated Sorted Array | 🟢 | March 02, 2024 | - | - |
238. Product of Array Except Self | 🟢 | March 02, 2024 | - | - |
977. Squares of a Sorted Array | 🟢 | March 03, 2024 | - | - |
56. Merge Intervals | 🟢 | March 03, 2024 | - | - |
209. Minimum Size Subarray Sum | 🟢 | March 03, 2024 | medium | - |
67. Add Binary | 🟢 | March 04, 2024 | - | - |
59. Spiral Matrix II | 🟡 | March 04, 2024 | - | - |
11. Container With Most Water | 🟢 | March 07, 2024 | - | - |
76. Minimum Window Substring | 🟢 | March 08, 2024 | hard | - |
36. Valid Sudoku | 🟡 | March 09, 2024 | - | - |
271. Encode and Decode Strings | 🟢 | March 13, 2024 | - | - |
128. Longest Consecutive Sequence | 🟡 | March 13, 2024 | - | - |
981. Time Based Key-Value Store | 🟢 | March 14, 2024 | - | - |
875. Koko Eating Bananas | 🟢 | March 14, 2024 | - | - |
74. Search a 2D Matrix | 🟢 | March 14, 2024 | medium | - |
4. Median of Two Sorted Arrays | 🔴 | March 14, 2024 | hard | - |
153. Find Minimum in Rotated Sorted Array | 🟢 | March 14, 2024 | - | - |
567. Permutation in String | 🟢 | March 17, 2024 | - | - |
424. Longest Repeating Character Replacement | 🟢 | March 17, 2024 | - | - |
647. Palindromic Substrings | 🟢 | March 19, 2024 | - | - |
57. Insert Interval | 🟡 | March 20, 2024 | - | - |
268. Missing Number | 🟢 | March 20, 2024 | - | - |
1851. Minimum Interval to Include Each Query | 🔴 | March 20, 2024 | hard | - |
53. Maximum Subarray | 🟢 | March 26, 2024 | - | - |
48. Rotate Image | 🟡 | March 27, 2024 | medium | - |
43. Multiply Strings | 🟡 | March 27, 2024 | medium | - |
1004. Max Consecutive Ones III | 🟢 | March 28, 2024 | - | - |
658. Find K Closest Elements | 🔴 | April 25, 2024 | medium | Mid pointer is start of the interval, r start at length - 2. Now, compare two values, m and m + k. If m + k is closer, that means, everything before m is outside of consideration. Else, everything beyond m + k is outside of consideration. |
34. Find First and Last Position of Element in Sorted Array | 🟢 | April 25, 2024 | medium | Basically the combination of finding the left most and right most index of a number |
334. Increasing Triplet Subsequence | 🟢 | April 27, 2024 | medium | If the two values are decreasing, it would reset the first value , and the second value will remain as inf |
122. Best Time to Buy and Sell Stock II | 🔴 | June 03, 2024 | medium | Simply one pass to capture all consecutive increasing gaps |
6. Zigzag Conversion | 🔴🟡🟢 | June 05, 2024 | medium | Except for the first and last row, other row have one additional value between each step |
15. 3 Sum | 🟢 | June 08, 2024 | medium | check left and right pointer when removing the duplicates |
833. Find And Replace in String | 🔴 | June 16, 2024 | medium | To sort multiple array with the order of a single array, can use zip, then unzip by taking the transpose (zip(*array)) |
624. Maximum Distance in Arrays | 🔴 | July 29, 2024 | medium | Keep a global min and max for the previous array values, compare with the new array's max and min to deduce the result range, and updated the global max/min |
280. Wiggle Sort | 🔴 | July 29, 2024 | medium | Just make sure even index is smaller the prev, odd index greater than prev, else swap with prev |
2334. Subarray With Elements Greater Than Varying Threshold | 🔴 | September 19, 2024 | medium | # Firstly, we can compare the min_value for each sub_array to see if it satisfy the condition |
Since threshold is constant, that mean the higher the k is, more likely the current element is greater than that
Hence find the longest sub_array for each element such that the element is the minimum |
| 767. Reorganize String | 🔴 | September 21, 2024 | medium | Fill out the most common character first |
| 42. Trapping Rain Water | 🟡 | September 26, 2024 | hard | To evaluate water a index l, it relies on the l_max variable, and l_max would always smaller or equal to r_max since we are moving the pointer to follow such logic |
| 2402. Meeting Rooms III | 🟡 | September 26, 2024 | medium | Sort the meetings, keep a queue for current meetings and available rooms |
| 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold | 🟡 | October 07, 2024 | medium | Prefix sum |
| 1653. Minimum Deletions to Make String Balanced | 🟡 | October 30, 2024 | medium | Minimum two loop through the array, keep track of number of a and number of b |
| 27. Remove Element | 🟢 | December 13, 2024 | - | - |
| 253. Meeting Rooms II | 🟡 | December 13, 2024 | - | - |
| 2461. Maximum Sum of Distinct Subarrays With Length K | 🟢 | January 11, 2025 | medium | - |
| 498. Diagonal Traverse | 🔴 | January 21, 2025 | medium | - |