Peek
Read the top item without removing it.
Stack: Push, pop, peek
peek shows 3 without removing it.
Cost
- Best
- O(1)
- Average
- O(1)
- Worst
- O(1)
- Space
- O(1)
Before this
Taught by the same lesson
Stack covers these too, in the same run.
Read the top item without removing it.
peek shows 3 without removing it.
Stack covers these too, in the same run.