gifts
array to it.k
times:
a. Extract the maximum element from the priority queue.
b. Calculate the floor of the square root of the extracted element.
c. Push the calculated square root back into the priority queue.k
iterations, sum up all the elements remaining in the priority queue to get the total number of gifts left.