Given an integer k and queue Q of integers. Write a program to reverse the order of the first k elements of the queue. The other elements will be in the same relative order. Following standard operations are allowed on the queue:

  • enqueue(x) : Insert an item x to the rear of queue
  • dequeue() : Remove an item from front of queue
  • size() : Returns number of item in queue.
  • peek() : Get the front item.
  • empty() : Return whether the queue is empty.

Example 1

Input: Q = [1, 2, 3, 4, 5]
       k = 5
Output: Q = [5, 4, 3, 2, 1]
Explanation: The first 5 elements of Q are reversed.

Example 2

Input: Q = [1, 2, 3, 4, 5, 6]
       k = 4
Output: Q = [4, 3, 2, 1, 5, 6]
Explanation: The first 4 elements of Q are reversed.