#3264

Final Array State After K Multiplication Operations I

easy · 86.9% accepted · 545 likes · top 98%

array · math · heap (priority queue) · simulation

⊣ practice⊣ open on leetcode ↗

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.

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

Solution