 All Problems
Design Circular Queue
medium
design
array
queue
amazon
microsoft

Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO principle and the last position is connected back to the first position.

Implement MyCircularQueue:

  • MyCircularQueue(int k)
  • boolean enQueue(int value)
  • boolean deQueue()
  • int Front()
  • int Rear()
  • boolean isEmpty()
  • boolean isFull()

Example:

MyCircularQueue(3), enQueue(1)→T, enQueue(2)→T, enQueue(3)→T, enQueue(4)→F,
Rear()→3, isFull()→T, deQueue()→T, enQueue(4)→T, Rear()→4
Run to check your code against the sample cases, or submit to run every case