⚡ AlgoZen_
~/home/stack_&_queue/stack_(lifo)1 / 2

Stack (LIFO)

Beginner

A Last-In-First-Out data structure. Push adds to the top, pop removes from the top. Like a stack of plates — you always deal with the topmost item.

time:O(1) per op
space:O(n)
⚡ +100_XP
step[1/10]
> Start
Stack: LIFO — Last In, First Out. Think of a stack of plates: you always take from the top.

// tap NEXT STEP to walk through one step at a time