You are given an integer array nums and an integer k.
In one operation, you can select any contiguous subarray of nums whose sum of elements is divisible by k and remove it from the array. When a subarray is removed, the remaining elements on both sides merge together to form the updated array.
Return the minimum possible sum of the remaining elements in nums after performing this operation any number of times.
Constraints:
nums.length
nums[i]
k
You are given an integer array nums and an integer k.
In one operation, you can select any contiguous subarray of nums whose sum of elements is divisible by k and remove it from the array. When a subarray is removed, the remaining elements on both sides merge together to form the updated array.
Return the minimum possible sum of the remaining elements in nums after performing this operation any number of times.
Constraints:
nums.length
nums[i]
k