Stacks coding challenges

Practise stacks with 5 coding challenges, from easy to hard. Every challenge runs in your browser with instant tests, an AI review of your code and community solutions to compare.

Medium · 3 Hard · 2

Skills you'll practise: Monotonic stackStacksArea calculationExecuting instructionsLinear timeRAIIRunning minimumTokenizing
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
226
Challenges
5
Solutions shared
3
Languages

All challenges

Search by topic, language, or difficulty.

5 challenges
Hard

Largest Rectangle in a Histogram

Find the largest rectangle that fits under a histogram.

You'll learn Monotonic stackArea calculation
AdvancedCompetitive-programmingStacks
No solutions yet
Hard

Mini Stack-Language Interpreter

Evaluate a small stack language.

You'll learn TokenizingExecuting instructions
InterpretersParsingStacks
No solutions yet
Medium

Nearest Smaller Value to the Left

For each number, find the closest earlier position containing a strictly smaller number.

You'll learn Monotonic stackLinear time
ArraysStacks
No solutions yet
Medium

RAII Release Order

Work out the order in which scoped resources are released when their scopes end, as RAII guarantees.

You'll learn RAIIStacks
Data-structuresSimulationStacks
No solutions yet
Medium

Min Stack

Build a stack that reports its smallest element instantly after any push or pop.

You'll learn StacksRunning minimum
Data-structuresStacks
No solutions yet