1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public class Solution { public int[] getFinalState(int[] nums, int k, int multiplier) { for (int i=0;i<k;i++){ fun1(nums,multiplier); } return nums; }
public void fun1(int[] nums, int multiplier) { int index = 0; for (int i = 1; i < nums.length; i++) { if (nums[index] > nums[i]) { index = i; } } nums[index] = nums[index] * multiplier; } }
|