Two pointers - broyda/cp-lib GitHub Wiki
- Most two pointer problems can be solved using binary search too, but the time complexity differs.
- If you have only one binary search, that can be convereted into a two pointer soluton. If there are more than 1 binary search, that cannot be converted to a binary search problem.
- Hint:
If the order of the elements does NOT matter in a problem, sort the array since the algorithm may be simplified as a result of the sorting.