What is Two Pointer Technique in arrays?

Updated Apr 28, 2026

Short answer

Two pointers use two indices to traverse array efficiently.

Deep explanation

The two-pointer technique involves maintaining two indices (left and right) to solve problems like searching pairs, reversing arrays, or removing duplicates efficiently in O(n).

Real-world example

Checking if a sorted array has two numbers summing to target.

Common mistakes

  • Using on unsorted arrays incorrectly.

Follow-up questions

  • When use two pointers?
  • Why efficient?

More Arrays interview questions

View all →