Implement Stack using Queues

Medium

📝 Description

Implement a stack using two queues with push, pop, top, and empty operations

Input Format

Series of stack operations (push x, pop, top, empty)

Output Format

Results of operations

Constraints

1 ≤ x ≤ 100 At most 100 operations

🔍 Sample Input

push(1), push(2), top(), pop(), empty()
            

✅ Sample Output

2, 2, false
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run