Need to build a circular queue, first item will get overwritten when the queue overflows or the capacity finishes. In normal sense, newest item would replace the oldest item.
Circular Queue is also a linear data structure, which follows the principle of FIFO(First In First Out),
but instead of ending the queue at the last position, it again starts from the first position after the last,
hence making the queue behave like a circular data structure.
Youtube playlist for more coding challenge like this:
Github Code Repository for coding challenge:
For details visit:
If you have a better/ different solution, please share your solution in the comment.