#3266

Final Array State After K Multiplication Operations II

hard · 13.1% accepted · 179 likes · top 0%

array · heap (priority queue) · simulation

Description

You are given an integer array nums, an integer k, and an integer multiplier.

You need to perform k operations on nums. In each operation:

- Find the minimum value x in nums. If there are multiple occurrences of the minimum value, select the one that appears first.

- Replace the selected minimum value x with x * multiplier.

After the k operations, apply modulo 109 + 7 to every value in nums.

Return an integer array denoting the final state of nums after performing all k operations and then applying the modulo.

Solution