Skip to content

Stack problems,
and the tell.

Something has to wait until the thing after it arrives: brackets, nesting, undo, the next greater element. 113 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. Something has to wait until the thing after it arrives: brackets, nesting, undo, the next greater element.

The mechanism. Push what is unfinished. When the current item resolves the top of the stack, pop and record. What is left at the end never resolved.

What goes wrong. Forgetting the final check. An input where everything matched so far can still leave the stack non-empty.

The ones asked most often.

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

  1. Number of Visible People in a QueueHardasked at 6 companies
  2. Valid Parenthesis StringMediumasked at 5 companies
  3. Remove All Adjacent Duplicates in String IIMediumasked at 4 companies
  4. Exclusive Time of FunctionsMediumasked at 4 companies
  5. Max StackHardasked at 4 companies
  6. Decoded String at IndexMediumasked at 2 companies
  7. Validate Stack SequencesMediumasked at 1 companies
  8. Smallest K-Length Subsequence With Occurrences of a LetterHardasked at 1 companies
  9. Final Prices With a Special Discount in a ShopEasyasked at 0 companies
  10. Clear DigitsEasyasked 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 stack problems.

Free to start, no card.

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

Something has to wait until the thing after it arrives: brackets, nesting, undo, the next greater element.

How many stack 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 113, split roughly 19 easy, 65 medium and 29 hard in the sample we show, so work up rather than across.

What goes wrong most often in stack problems?

Forgetting the final check. An input where everything matched so far can still leave the stack non-empty.

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.