641. Design Circular Deque

Practice Design Circular Deque for free on NudgeCode: Medium, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Design a double-ended queue with a fixed capacity k, backed by a circular buffer (don't use a built-in deque).

Each test is a list of operations and their arguments; the expected output lists what each call returns (null for the constructor).

Example

["MyCircularDeque","insertLast","insertLast","insertFront","insertFront","getRear","isFull","deleteLast","insertFront","getFront"]
[[3],[1],[2],[3],[4],[],[],[],[4],[]]
->  [null,true,true,true,false,2,true,true,true,4]

Constraints