A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Implement a FIFO queue class using two stacks. Support push(x), pop() (return popped value), peek() (return front), empty() (return bool). Test harness passes ops and returns their outputs parallel: None for push, the value for pop/peek, True/False for empty.
Summary
A queue in sheep's clothing.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.