Leetcode 3689. Maximum Total Subarray Value I
Since subarrays can overlap and be repeated, the optimal pick is any subarray containing the global maximum and minimum, so the maximum total is simply k * (max(nums) - min(nums)).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.