Difficulty: Medium
Acceptance: 81.28%
Points: 30.00
Given an integer **K** and a queue of integers, the task is to reverse the order of the first K elements in the queue, while keeping the remaining elements in their original relative order. The following standard queue operations are allowed: - enqueue(x): Adds an element x to the rear of the queue. - dequeue(): Removes an element from the front of the queue. - size(): Returns the current number of elements in the queue. - front(): Retrieves the element at the front of the queue. Complete the given function **modifyQueue()**, which takes a queue and an integer K as input parameters, and returns the modified queue. The driver code will handle the printing of the queue automatically.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(K)
