two pointers
Easy
Number | Note | Times |
---|---|---|
26. Remove Duplicates from Sorted Array | starting from k=1 and check curr nums[i] with previous nums[k] | |
27. Remove Element | nums[count] and nums[i] | |
88. Merge Sorted Array | add the biggest from last to first, use 3 pointers, edge case is second arr remains | |
125. Valid Palindrome | ||
283. Move Zeroes | ||
344. Reverse String | ||
680. Valid Palindrome II | ||
844. Backspace String Compare | ||
977. Squares of a Sorted Array | ||
1768. Merge Strings Alternately |
Medium
Number | Note | Times |
---|---|---|
11. Container With Most Water | two pointer, left right, check min height, find max space, increase or decrease when which one is smaller | |
15. 3Sum | sort, fix each + 2 pointer, check two consecutive in fix and check two consecutive in pointer (yes, increase left) | |
16. 3Sum Closest | ||
18. 4Sum | ||
167. Two Sum II - Input Array Is Sorted | ||
189. Rotate Array | ||
881. Boats to Save People |
Hard
Number | Note | Times |
---|---|---|
42. Trapping Rain Water |