Your question is Queue Implementation From Scratch. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Implement a queue using basic data structures.
Implement def implement_queue(operations):, where operations is a list of command lists and each command is enqueue with a value, dequeue, peek, or is_empty; return a list containing results from non-enqueue commands. dequeue and peek return None when empty, is_empty returns a boolean, and operations must preserve FIFO order. Examples: [["enqueue", 4], ["enqueue", 7], ["dequeue"], ["peek"]] returns [4, 7]; ["is_empty"] returns [True]. Constraints: at most 10^4 operations, integer values, and valid commands only.
def implement_queue(operations):