Arrays
Binary Search
O(logn). Sorted Array.
- find specific number
- border
- biggest/smallest target under conditions
before coding, need to definition [x, y] or [x, y) to control the border.
Two Pointer
Fast vs. Slow. In-place. Fast pointer used to search, Slow pointer used to fill.
- move/remove elements
- remove duplicate
- move some elements
in some cases it could be from the beginning and the end of array. normally at those cases the array provided is sorted.
Sliding Window
Continuous Sub-Array. Longest? Shortest?
- basically like from a long sequence to find a specific part of it.
normally using right side to explore, after every time right border moved, as much as possible to reduce the left border.