Reverse method reverses elements of a queue

前端 未结 4 1057
死守一世寂寞
死守一世寂寞 2021-01-12 15:07

This is not a HW or assignment. This is something i\'m practicing myself.

Given a queue, write a Reverse method reverses elements of a queue. MyQueue remains unchan

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 15:51

    1. dequeue the elements of the input queue onto a stack
    2. pop the elements off the stack, enqueueing each into the output queue.

提交回复
热议问题