3266. Final Array State After K Multiplication Operations II Hard

@problem@discussion
#Array#Heap (Priority Queue)#Simulation



1/**
2 * [3266] Final Array State After K Multiplication Operations II
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 * After the k operations, apply modulo 10^9 + 7 to every value in nums.
11 * Return an integer array denoting the final state of nums after performing all k operations and then applying the modulo.
12 *  
13 * <strong class="example">Example 1:
14 * <div class="example-block">
15 * Input: <span class="example-io">nums = [2,1,3,5,6], k = 5, multiplier = 2</span>
16 * Output: <span class="example-io">[8,4,6,5,6]</span>
17 * Explanation:
18 * <table>
19 * 	<tbody>
20 * 		<tr>
21 * 			<th>Operation</th>
22 * 			<th>Result</th>
23 * 		</tr>
24 * 		<tr>
25 * 			<td>After operation 1</td>
26 * 			<td>[2, 2, 3, 5, 6]</td>
27 * 		</tr>
28 * 		<tr>
29 * 			<td>After operation 2</td>
30 * 			<td>[4, 2, 3, 5, 6]</td>
31 * 		</tr>
32 * 		<tr>
33 * 			<td>After operation 3</td>
34 * 			<td>[4, 4, 3, 5, 6]</td>
35 * 		</tr>
36 * 		<tr>
37 * 			<td>After operation 4</td>
38 * 			<td>[4, 4, 6, 5, 6]</td>
39 * 		</tr>
40 * 		<tr>
41 * 			<td>After operation 5</td>
42 * 			<td>[8, 4, 6, 5, 6]</td>
43 * 		</tr>
44 * 		<tr>
45 * 			<td>After applying modulo</td>
46 * 			<td>[8, 4, 6, 5, 6]</td>
47 * 		</tr>
48 * 	</tbody>
49 * </table>
50 * </div>
51 * <strong class="example">Example 2:
52 * <div class="example-block">
53 * Input: <span class="example-io">nums = [100000,2000], k = 2, multiplier = 1000000</span>
54 * Output: <span class="example-io">[999999307,999999993]</span>
55 * Explanation:
56 * <table>
57 * 	<tbody>
58 * 		<tr>
59 * 			<th>Operation</th>
60 * 			<th>Result</th>
61 * 		</tr>
62 * 		<tr>
63 * 			<td>After operation 1</td>
64 * 			<td>[100000, 2000000000]</td>
65 * 		</tr>
66 * 		<tr>
67 * 			<td>After operation 2</td>
68 * 			<td>[100000000000, 2000000000]</td>
69 * 		</tr>
70 * 		<tr>
71 * 			<td>After applying modulo</td>
72 * 			<td>[999999307, 999999993]</td>
73 * 		</tr>
74 * 	</tbody>
75 * </table>
76 * </div>
77 *  
78 * Constraints:
79 * 
80 * 	1 <= nums.length <= 10^4
81 * 	1 <= nums[i] <= 10^9
82 * 	1 <= k <= 10^9
83 * 	1 <= multiplier <= 10^6
84 * 
85 */
86pub struct Solution {}
87
88// problem: https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-ii/
89// discuss: https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-ii/discuss/?currentPage=1&orderBy=most_votes&query=
90
91// submission codes start here
92
93impl Solution {
94    pub fn get_final_state(nums: Vec<i32>, k: i32, multiplier: i32) -> Vec<i32> {
95        vec![]
96    }
97}
98
99// submission codes end
100
101#[cfg(test)]
102mod tests {
103    use super::*;
104
105    #[test]
106    fn test_3266() {
107    }
108}
109


Back
© 2025 bowen.ge All Rights Reserved.