Question DSA-QUE-0013
MediumHow can a stack be implemented with queues?
- A.
With one queue: after each enqueue, rotate the earlier elements behind the new one
- B.
It is impossible
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Queues and Deques question
How can a stack be implemented with queues?
With one queue: after each enqueue, rotate the earlier elements behind the new one
It is impossible
Sign up free to see the answer and a step-by-step explanation.
By sorting the queue
With a single dequeue operation