Skip to content

Ordered Set problems,
and the tell.

You need the data sorted while it keeps changing, or the nearest value above or below a key. 35 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. You need the data sorted while it keeps changing, or the nearest value above or below a key.

The mechanism. A balanced tree set keeps order through inserts and deletes, and answers the nearest-value question in log n. In a language without one, a heap plus lazy deletion often covers the same ground.

What goes wrong. Reaching for one when a heap or a sorted array would do. The constant factor is real.

The ones asked most often.

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

  1. Max StackHardasked at 4 companies
  2. Design a 3D Binary Matrix with Efficient Layer TrackingMediumasked at 1 companies
  3. Falling SquaresHardasked at 1 companies
  4. Create Sorted Array through InstructionsHardasked at 1 companies
  5. Partition Array Into Two Arrays to Minimize Sum DifferenceHardasked at 6 companies
  6. Tweet Counts Per FrequencyMediumasked at 1 companies
  7. Range ModuleHardasked at 2 companies
  8. Minimum Reverse OperationsHardasked at 1 companies
  9. Brightest Position on StreetMediumasked at 4 companies
  10. Design Log Storage SystemMediumasked at 1 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 ordered set problems.

Free to start, no card.

Start practising
How do I know a problem is a ordered set problem?

You need the data sorted while it keeps changing, or the nearest value above or below a key.

How many ordered set 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 35, split roughly 0 easy, 13 medium and 22 hard in the sample we show, so work up rather than across.

What goes wrong most often in ordered set problems?

Reaching for one when a heap or a sorted array would do. The constant factor is real.

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.