What is the two pointers technique?easy
Answer
Two pointers use two indexes that move through a sequence to avoid nested loops.
Explanation
It is common for sorted arrays, palindrome checks, merging, partitioning, and pair-sum problems. The key is knowing how pointer movement changes the search space.
Follow-upWhy does sorting often make two pointers possible?