The Impersonator
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L5
Problem
Implement a FIFO queue backed by two stacks. Support enqueue(x), dequeue() (return value), peek() (return front). Test harness passes operations; returns parallel results: None for enqueue, the value for dequeue/peek.
Summary
You only have stacks. Make a queue anyway.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.