3976. Maximum Subarray Sum After Multiplier
You are given an integer array
numsand a positive integerk.You must choose exactly one subarray of
numsand perform exactly one of the following operations:
- Multiply each number in the chosen subarray by
k.- Divide each number in the chosen subarray by
k.
- When dividing a positive number by
k, use the floor value of the division result.- When dividing a negative number by
k, use the ceiling value of the division result.Return the maximum possible sum of a non-empty subarray in the resulting array.
Note that the subarray chosen for the operation and the subarray chosen for the sum may be different.
1 | class Solution { |