|
| 1 | +<p>You are given an integer array <code>nums</code>, an integer <code>k</code>, and an integer <code>multiplier</code>.</p> |
| 2 | + |
| 3 | +<p>You need to perform <code>k</code> operations on <code>nums</code>. In each operation:</p> |
| 4 | + |
| 5 | +<ul> |
| 6 | + <li>Find the <strong>minimum</strong> value <code>x</code> in <code>nums</code>. If there are multiple occurrences of the minimum value, select the one that appears <strong>first</strong>.</li> |
| 7 | + <li>Replace the selected minimum value <code>x</code> with <code>x * multiplier</code>.</li> |
| 8 | +</ul> |
| 9 | + |
| 10 | +<p>Return an integer array denoting the <em>final state</em> of <code>nums</code> after performing all <code>k</code> operations.</p> |
| 11 | + |
| 12 | +<p> </p> |
| 13 | +<p><strong class="example">Example 1:</strong></p> |
| 14 | + |
| 15 | +<div class="example-block"> |
| 16 | +<p><strong>Input:</strong> <span class="example-io">nums = [2,1,3,5,6], k = 5, multiplier = 2</span></p> |
| 17 | + |
| 18 | +<p><strong>Output:</strong> <span class="example-io">[8,4,6,5,6]</span></p> |
| 19 | + |
| 20 | +<p><strong>Explanation:</strong></p> |
| 21 | + |
| 22 | +<table> |
| 23 | + <tbody> |
| 24 | + <tr> |
| 25 | + <th>Operation</th> |
| 26 | + <th>Result</th> |
| 27 | + </tr> |
| 28 | + <tr> |
| 29 | + <td>After operation 1</td> |
| 30 | + <td>[2, 2, 3, 5, 6]</td> |
| 31 | + </tr> |
| 32 | + <tr> |
| 33 | + <td>After operation 2</td> |
| 34 | + <td>[4, 2, 3, 5, 6]</td> |
| 35 | + </tr> |
| 36 | + <tr> |
| 37 | + <td>After operation 3</td> |
| 38 | + <td>[4, 4, 3, 5, 6]</td> |
| 39 | + </tr> |
| 40 | + <tr> |
| 41 | + <td>After operation 4</td> |
| 42 | + <td>[4, 4, 6, 5, 6]</td> |
| 43 | + </tr> |
| 44 | + <tr> |
| 45 | + <td>After operation 5</td> |
| 46 | + <td>[8, 4, 6, 5, 6]</td> |
| 47 | + </tr> |
| 48 | + </tbody> |
| 49 | +</table> |
| 50 | +</div> |
| 51 | + |
| 52 | +<p><strong class="example">Example 2:</strong></p> |
| 53 | + |
| 54 | +<div class="example-block"> |
| 55 | +<p><strong>Input:</strong> <span class="example-io">nums = [1,2], k = 3, multiplier = 4</span></p> |
| 56 | + |
| 57 | +<p><strong>Output:</strong> <span class="example-io">[16,8]</span></p> |
| 58 | + |
| 59 | +<p><strong>Explanation:</strong></p> |
| 60 | + |
| 61 | +<table> |
| 62 | + <tbody> |
| 63 | + <tr> |
| 64 | + <th>Operation</th> |
| 65 | + <th>Result</th> |
| 66 | + </tr> |
| 67 | + <tr> |
| 68 | + <td>After operation 1</td> |
| 69 | + <td>[4, 2]</td> |
| 70 | + </tr> |
| 71 | + <tr> |
| 72 | + <td>After operation 2</td> |
| 73 | + <td>[4, 8]</td> |
| 74 | + </tr> |
| 75 | + <tr> |
| 76 | + <td>After operation 3</td> |
| 77 | + <td>[16, 8]</td> |
| 78 | + </tr> |
| 79 | + </tbody> |
| 80 | +</table> |
| 81 | +</div> |
| 82 | + |
| 83 | +<p> </p> |
| 84 | +<p><strong>Constraints:</strong></p> |
| 85 | + |
| 86 | +<ul> |
| 87 | + <li><code>1 <= nums.length <= 100</code></li> |
| 88 | + <li><code>1 <= nums[i] <= 100</code></li> |
| 89 | + <li><code>1 <= k <= 10</code></li> |
| 90 | + <li><code>1 <= multiplier <= 5</code></li> |
| 91 | +</ul> |
0 commit comments