232. Implement Queue using Stacks

Practice Implement Queue using Stacks for free on NudgeCode: Easy, Stack pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Build a first-in-first-out queue using only stack operations (push to top, pop from top, look at top, size, is empty).

Each test is a list of operations and their arguments; the expected output lists what each call returns (null for calls that return nothing).

Example

["MyQueue","push","push","peek","pop","empty"]
[[],[1],[2],[],[],[]]
->  [null,null,null,1,1,false]

Constraints