Skip to main content
Back to problems
Leetcode
Medium
Arrays
Heaps
Sorting
Amazon
Final Array State After K Multiplication Operations II

Repeatedly multiply the smallest array element by a factor for k operations, then return the final array state.

Acceptance 0%
Problem Statement

Problem

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

Repeat the following operation exactly k times:

  1. Choose the smallest value in nums.
  2. If there are multiple smallest values, choose the one with the smallest index.
  3. Replace that element with its value multiplied by multiplier.

After all operations, return the final state of the array.

This problem asks you to efficiently simulate the process without re-scanning the entire array from scratch on every step.

Input Format

  • An integer array nums
  • An integer k
  • An integer multiplier

Output Format

  • Return the array after performing the operation k times.

Constraints

  • 1 <= nums.length
  • k >= 0
  • multiplier >= 1
  • Values may grow during the process, so use a data structure that can repeatedly access the current minimum efficiently.
Examples
Sample cases returned by the problem API.

Example 1

Input

nums = [2,1,3], k = 3, multiplier = 2

Output

[4,4,3]

Explanation

Operations:

  1. Pick 1 at index 1 -> [2,2,3]
  2. Pick 2 at index 0 (tie with index 1, smaller index wins) -> [4,2,3]
  3. Pick 2 at index 1 -> [4,4,3]

Example 2

Input

nums = [1,2,1], k = 2, multiplier = 3

Output

[3,2,3]

Explanation

Operations:

  1. Pick 1 at index 0 -> [3,2,1]
  2. Pick 1 at index 2 -> [3,2,3]

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.