Question
Implement and exercise a fixed-capacity circular queue (ring buffer). You are given a capacity and a list of operations; each operation is a list whose first element is the op name. Supported ops: ['enQueue', x] inserts x at the rear and returns True, or False if full; ['deQueue'] removes the front and returns True, or False if empty; ['Front'] returns the front value or -1 if empty; ['Rear'] returns the rear value or -1 if empty; ['isEmpty'] returns a bool; ['isFull'] returns a bool. Return the list of results, one per operation, in order. There are 1 to 3000 operations and capacity is between 1 and 1000.
run_circular_queue(capacity: int, ops: list[list]) → list[3,[["enQueue",1],["enQueue",2],["enQueue",3],["enQueue",4],["Rear"],["isFull"],["deQueue"],["enQueue",4],["Rear"]]]out[true,true,true,false,3,true,true,true,4]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.