or each operation, we choose the element i with the highest value?
therefore the floor calculation should result the biggest reduction in stones per iteration
π€What Did I Struggle With?
the floor calculation is not 1:1 to the question description
integer division in C++ already floors the results, so floor is unecessary
π‘ Explanation of Solution
init a priority queue iterate through piles,
inserting it into the pq iterate k times, getting the max element from the pq,
performing the floor calculation,
pushing it back into the queue, and repeating k times
β Complexity Analysis
Heap Init : O(n log n) for inserting all elements into the heap
Space Complexity: O(n)