🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Two Pointer

In plain terms

Using two indices that move through data to solve problems efficiently.

Going deeper

The two-pointer technique uses a pair of indices (often from both ends or at different speeds) to scan data in linear time. It elegantly solves many array and string problems.

Under the hood

Turns many O(nΒ²) brute forces into O(n); common patterns include opposite-ends and fast/slow pointers.

Examples

Pair sums, palindrome checks, merging sorted arrays, cycle detection.

Think of it like...

Like two people closing in from both ends of a row to find a matching pair.

Feedback & Bug Report