You are given an integer array nums of length n and an integer k.
In one operation, you may choose any element of nums and rearrange its decimal digits in any order to form a new integer.
Return the maximum possible sum of the array after performing at most k operations.
Example 1:
Input: nums = [123,45], k = 1
Output: 366
Explanation:
nums[0] = 123 and rearrange its digits to form 321.[321, 45]. Thus, the total sum is 321 + 45 = 366.Example 2:
Input: nums = [102,90,14], k = 2
Output: 341
Explanation:
nums[0] = 102 and rearrange its digits to form 210.nums[2] = 14 and rearrange its digits to form 41.[210, 90, 41]. Thus, the total sum is 210 + 90 + 41 = 341.Constraints:
1 <= n == nums.length <= 1051 <= nums[i] <= 1091 <= k <= n[123,45] 1
[102,90,14] 2