Leetcode 3381. Maximum Subarray Sum With Length Divisible by K
Find the maximum sum of any contiguous subarray whose length is a multiple of k; this reduces to using prefix sums and pairing indices with the same index mod k so you can maximize the difference between a current prefix and the smallest earlier prefix in the same modulo class.
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.