Process queue operations using only stack-style push and pop behavior internally.
Return one output per operation. Constructor and push produce null; pop and peek return values; empty returns a boolean.
Inputoperations = ["MyQueue", "push", "push", "peek", "pop", "empty"], values = [[], [1], [2], [], [], []]
Output[null, null, null, 1, 1, false]
1 entered before 2, so peek shows 1 and pop removes it. The queue still holds 2, so empty returns false. The constructor and pushes return null.
Inputoperations = ["MyQueue", "push", "pop", "empty"], values = [[], [7], [], []]
Output[null, null, 7, true]
After pushing 7, pop removes it and returns 7. The queue then has no items, so empty returns true.
At most 100 operations are performed.