A Deque (Double-Ended Queue) is a linear data structure that allows insertion and deletion of elements from both ends. Unlike a stack or a queue, where operations are restricted to one end, a deque provides flexibility to add or remove elements at the front as well as the rear.
Deque can act as both Stack and Queue
It is useful in many problems where we need to have a subset of all operations also like insert/remove at front and insert/remove at the end.
It is typically implemented either using a doubly linked list or circular array.