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

Repeatedly pick the smallest array element, multiply it by a given factor, and return the final array state after kk operations.

Acceptance 0%
Problem Statement

Problem

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

Perform exactly k operations. In each operation:

  1. Find the smallest value in the array. If multiple elements are equally small, choose the one with the smallest index.
  2. Multiply that chosen value by multiplier.

After all operations, return the resulting array.

The array is updated in place after every operation, so later choices use the latest values.

Goal

Simulate the process efficiently and return the final array state.

Input Format

  • nums: integer array
  • k: number of operations to perform
  • multiplier: integer factor applied to the chosen element each step

Output Format

  • Return the final state of nums after exactly k operations.

Constraints

  • The array length is at least 1.
  • Perform exactly k updates.
  • If there are ties for the minimum value, pick the leftmost occurrence.
  • Values may change after each multiplication, so each step depends on the previous one.
Examples
Sample cases returned by the problem API.

Example 1

Input

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

Output

[6, 3, 3]

Explanation

Step 1: the minimum is 1 at index 1, so it becomes 3. Array becomes [2, 3, 3]. Step 2: the minimum is 2 at index 0, so it becomes 6. Final array is [6, 3, 3].

Example 2

Input

nums = [5], k = 4, multiplier = 2

Output

[80]

Explanation

There is only one element, so it is chosen every time: 5 -> 10 -> 20 -> 40 -> 80.

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.