3264. Final Array State After K Multiplication Operations I Easy
1/**
2 * [3264] Final Array State After K Multiplication Operations I
3 *
4 * You are given an integer array nums, an integer k, and an integer multiplier.
5 * You need to perform k operations on nums. In each operation:
6 *
7 * Find the minimum value x in nums. If there are multiple occurrences of the minimum value, select the one that appears first.
8 * Replace the selected minimum value x with x * multiplier.
9 *
10 * Return an integer array denoting the final state of nums after performing all k operations.
11 *
12 * <strong class="example">Example 1:
13 * <div class="example-block">
14 * Input: <span class="example-io">nums = [2,1,3,5,6], k = 5, multiplier = 2</span>
15 * Output: <span class="example-io">[8,4,6,5,6]</span>
16 * Explanation:
17 * <table>
18 * <tbody>
19 * <tr>
20 * <th>Operation</th>
21 * <th>Result</th>
22 * </tr>
23 * <tr>
24 * <td>After operation 1</td>
25 * <td>[2, 2, 3, 5, 6]</td>
26 * </tr>
27 * <tr>
28 * <td>After operation 2</td>
29 * <td>[4, 2, 3, 5, 6]</td>
30 * </tr>
31 * <tr>
32 * <td>After operation 3</td>
33 * <td>[4, 4, 3, 5, 6]</td>
34 * </tr>
35 * <tr>
36 * <td>After operation 4</td>
37 * <td>[4, 4, 6, 5, 6]</td>
38 * </tr>
39 * <tr>
40 * <td>After operation 5</td>
41 * <td>[8, 4, 6, 5, 6]</td>
42 * </tr>
43 * </tbody>
44 * </table>
45 * </div>
46 * <strong class="example">Example 2:
47 * <div class="example-block">
48 * Input: <span class="example-io">nums = [1,2], k = 3, multiplier = 4</span>
49 * Output: <span class="example-io">[16,8]</span>
50 * Explanation:
51 * <table>
52 * <tbody>
53 * <tr>
54 * <th>Operation</th>
55 * <th>Result</th>
56 * </tr>
57 * <tr>
58 * <td>After operation 1</td>
59 * <td>[4, 2]</td>
60 * </tr>
61 * <tr>
62 * <td>After operation 2</td>
63 * <td>[4, 8]</td>
64 * </tr>
65 * <tr>
66 * <td>After operation 3</td>
67 * <td>[16, 8]</td>
68 * </tr>
69 * </tbody>
70 * </table>
71 * </div>
72 *
73 * Constraints:
74 *
75 * 1 <= nums.length <= 100
76 * 1 <= nums[i] <= 100
77 * 1 <= k <= 10
78 * 1 <= multiplier <= 5
79 *
80 */
81pub struct Solution {}
82
83// problem: https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-i/
84// discuss: https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-i/discuss/?currentPage=1&orderBy=most_votes&query=
85
86// submission codes start here
87
88impl Solution {
89 pub fn get_final_state(nums: Vec<i32>, k: i32, multiplier: i32) -> Vec<i32> {
90 vec![]
91 }
92}
93
94// submission codes end
95
96#[cfg(test)]
97mod tests {
98 use super::*;
99
100 #[test]
101 fn test_3264() {
102 }
103}
104
Back
© 2025 bowen.ge All Rights Reserved.