Question d’entretien chez Amazon

Reverse first k elements of a queue.

Réponse à la question d'entretien

Utilisateur anonyme

3 déc. 2020

Dequeue first k elements into a stack, pop them out enqeue-ing them back to the Queue. Lastly Dequeue the remaining n-k elements from the queue and Enqueue them to the end of the Queue.