Skip to content

Array problems,
and the tell.

The input is a list and the answer is a position, a span, or a rearrangement of it. 1031 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 input is a list and the answer is a position, a span, or a rearrangement of it.

The mechanism. Most array problems come down to one walk with something remembered: a running total, a seen-before map, or a second index that never goes backwards. The brute force is two nested loops; the trick is almost always to carry forward what the inner loop would have recomputed.

What goes wrong. Index arithmetic at the edges. Off by one at the last element, and an empty array that never enters the loop at all.

The ones asked most often.

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

  1. Two SumEasyasked at 114 companies
  2. Spiral MatrixMediumasked at 45 companies
  3. Insert Delete GetRandom O(1)Mediumasked at 40 companies
  4. Rotate ImageMediumasked at 33 companies
  5. Intersection of Two ArraysEasyasked at 12 companies
  6. Walls and GatesMediumasked at 7 companies
  7. Shortest Path in a Grid with Obstacles EliminationHardasked at 6 companies
  8. Number of Visible People in a QueueHardasked at 6 companies
  9. Rotating the BoxMediumasked at 5 companies
  10. Maximum Performance of a TeamHardasked at 5 companies

Read it, watch it, then solve it.

The order that makes a pattern stick.

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 array problems.

Free to start, no card.

Start practising
How do I know a problem is a array problem?

The input is a list and the answer is a position, a span, or a rearrangement of it.

How many array 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 1031, split roughly 28 easy, 125 medium and 47 hard in the sample we show, so work up rather than across.

What goes wrong most often in array problems?

Index arithmetic at the edges. Off by one at the last element, and an empty array that never enters the loop at all.

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.