Keep two indices and move them through the data based on a condition. It often turns an O(n²) brute-force into O(n).
What Is It?
You maintain two pointers (indices) into your data and advance them according to a rule. Instead of checking every possible pair with nested loops, you exploit structure — usually sorted order — to skip work.