Stack With O(1) Reverse
Asked at Amazon · Coding Questions · Difficulty: Medium
Design a stack supporting `push(x)`, `pop()`, `top()`, and `reverse()` (which flips the stack so the current bottom becomes the top), all in O(1).
Loading the problem…
Asked at Amazon · Coding Questions · Difficulty: Medium
Design a stack supporting `push(x)`, `pop()`, `top()`, and `reverse()` (which flips the stack so the current bottom becomes the top), all in O(1).
Loading the problem…