LeetCode
Design Circular Deque
Click
here
for an explanation.