Tap here to switch tabs
Problem
Submissions

Problem: Final Array State After K Multiplication Operations II

Final Array State After K Multiplication Operations II updates an array repeatedly: multiply its minimum value each time, choose the lowest index on ties, and return it modulo a large prime.

Statement

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

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

  • Find the minimum value in nums. If there are multiple occurrences of the minimum value, choose the one with the smallest index.

  • Replace the chosen value with its product with multiplier.

Return an array of integers representing the final state of nums after performing all kk operations. Since the values can be large, return each element modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤109\leq 10^9

  • 1≤1 \leq multiplier ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Final Array State After K Multiplication Operations II

Final Array State After K Multiplication Operations II updates an array repeatedly: multiply its minimum value each time, choose the lowest index on ties, and return it modulo a large prime.

Statement

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

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

  • Find the minimum value in nums. If there are multiple occurrences of the minimum value, choose the one with the smallest index.

  • Replace the chosen value with its product with multiplier.

Return an array of integers representing the final state of nums after performing all kk operations. Since the values can be large, return each element modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤109\leq 10^9

  • 1≤1 \leq multiplier ≤106\leq 10^6