Pattern Recognition Drill
Easy Stacks & Queues
The Problem
Reverse a string using a stack.
What approach would you use?
Think about it before scrolling down.
Push each character, pop all into result. LIFO reverses the order. O(n).
In-place swap from both ends — more efficient (O(1) space) but the problem specifically asks for stack.
Common Trap
The problem constraints dictate the method here — 'using a stack' means use a stack.