Skip to content

Two Pointers problems,
and the tell.

The data is sorted or symmetric, and the answer is a pair, a span, or a comparison of two ends. 140 problems in the catalogue carry this tag, from first-week easy to interview hard.

Free to start. Running and submitting a solution never costs credits.

How the pattern actually works.

One mechanism, and the mistake that costs people the problem.

The tell. The data is sorted or symmetric, and the answer is a pair, a span, or a comparison of two ends.

The mechanism. Start an index at each end and move the one that cannot possibly improve the answer. Each move rules a candidate out for good, so one pass is enough.

What goes wrong. Moving both pointers at once. Move one, and only the one you can prove is safe to drop.

The ones asked most often.

By how often the catalogue records them being set, not by our opinion.

  1. Intersection of Two ArraysEasyasked at 12 companies
  2. Rotating the BoxMediumasked at 5 companies
  3. Find Beautiful Indices in the Given Array IMediumasked at 2 companies
  4. Count Pairs in Two ArraysMediumasked at 2 companies
  5. Sort Array By ParityEasyasked at 1 companies
  6. Maximum Product of First and Last Elements of a SubsequenceMediumasked at 1 companies
  7. Shortest Unsorted Continuous SubarrayMediumasked at 1 companies
  8. Find the Integer Added to Array IIMediumasked at 1 companies
  9. Reverse Prefix of WordEasyasked at 1 companies
  10. K-th Smallest Prime FractionMediumasked at 1 companies

Everything in the app, in one place.

Practice, interviews and the tools, all free to start. Swipe to see the rest.

Free to start: 100 AI credits when you sign up and 100 every month. Start free in the app

About two pointers problems.

Free to start, no card.

Start practising
How do I know a problem is a two pointers problem?

The data is sorted or symmetric, and the answer is a pair, a span, or a comparison of two ends.

How many two pointers problems should I solve?

Enough to stop needing the hint, which is usually ten to fifteen across the levels, not the whole list. The catalogue tags 140, split roughly 37 easy, 86 medium and 17 hard in the sample we show, so work up rather than across.

What goes wrong most often in two pointers problems?

Moving both pointers at once. Move one, and only the one you can prove is safe to drop.

Is practising by pattern better than a problem sheet?

A sheet tells you what to solve. A pattern tells you why those problems sit together, which is the part that carries over to the problem you have not seen. That is why the app files every problem under its pattern.