Question
Implement a fixed-capacity circular deque (size k) backed by an array. Process ops: ['insertFront', x] / ['insertLast', x] add to the front/back and return True, or False if full; ['deleteFront'] / ['deleteLast'] remove from the front/back and return True, or False if empty; ['getFront'] / ['getRear'] return the front/rear value or -1 if empty; ['isEmpty'] / ['isFull'] return booleans. Return the list of results for every op, in order. k >= 1.
circular_deque(k: int, ops: list[list]) → list[3,[["insertLast",1],["insertLast",2],["insertFront",3],["insertFront",4],["getRear"],["isFull"],["deleteLast"],["insertFront",4],["getFront"]]]out[true,true,true,false,2,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.