Design your implementation of the circular double-ended queue (deque). Your implementation should support following operations: 1. MyCircularDeque(): Initializes the deque object. 2. insertFront(): Adds an item at the front of Deque. 3. insertLast(): Adds an item at the rear of Deque. 4. deleteFront(): Deletes the front item from the Deque and return it's value. If the deque is empty, return null. 5. deleteLast(): Deletes the last item from Deque and return it's value. If the deque is empty, return null. 6. getFront(): Gets the front item from the Deque. If the deque is empty, return null. 7. getRear(): Gets the last item from Deque. If the deque is empty, return null. 8. isEmpty(): Checks whether Deque is empty or not.
Input Format
Input is managed for you
Output Format
Output is managed for you
Constraints
None
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
insertLast 1 insertLast 2 insertFront 3 insertFront 4 getRear deleteLast getRear deleteLast insertFront 4 getFront
Output
2 2 1 1 4