mediumArrayDynamic Programming 0 views
Minimum Array Sum
You are given an integer array nums and three integers k, op1, and op2.
You are given an integer array nums and three integers k, op1, and op2.
You can perform the following operations on nums:
Note: Both operations can be applied to the same index, but at most once each.
Return the minimum possible sum of all elements in nums after performing any number of operations.
Example 1
Input: nums = [2,8,3,19,3], k = 3, op1 = 1, op2 = 1
Output: 23
Example 2
Input: nums = [2,4,3], k = 3, op1 = 2, op2 = 1
Output: 3
Constraints
- 1 <= nums.length <= 100
- 0 <= nums[i] <= 10^5
- 0 <= k <= 10^5
- 0 <= op1, op2 <= nums.length
Hints
Companies
No companies reported yet.
Discussion
Sign in to join the discussion.
Loading discussion...
Test results
No test cases yet.