J.P. Morgan interview question

Given a Queue and an integer K, reverse the first K elements in the Queue.

Interview Answer

Anonymous

1 Mar 2021

Wrote the algorithm to solve this using a stack. It took some time to implement the same.