Circular queue operations
Your task
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.
Examples
run_circular_queue(capacity: int, ops: list[list]) -> listExample 1
Input
run_circular_queue(3, [["enQueue", 1], ["enQueue", 2], ["enQueue", 3], ["enQueue", 4], ["Rear"], ["isFull"], ["deQueue"], ["enQueue", 4], ["Rear"]])Output
[True, True, True, False, 3, True, True, True, 4]