Algorithms: Two Pointers
Dec 2, 2020
Approach to Two Pointer problems
Strings Comparison containing Backspaces
3 parts of this Algorithm:
- Iterate the function to find the next valid character index.
- 3 conditions to cover for True and False.
- Update the index and repeat steps 1 and 2.
Sorted Minimum Window
3 Parts of this Algorithm:
- Find the first unsorted element from the left parallelly, find the first unsorted element from the right.
1.1 Edge Case
2. Find the minimum and maximum element.
3. Recheck the minimum and maximum element is at its first and last element or not.
Return the difference between the maximum and minimum pointer.