Search
⌘K

Leetcode 689. Maximum Sum of 3 Non-Overlapping Subarrays

Find three non-overlapping subarrays of length k whose total sum is maximized and return their starting indices (choose the lexicographically smallest tuple on ties). This is solved by computing k-length window sums and using prefix-sum/sliding-window + DP-like scans to track the best left and right intervals for each possible middle interval in linear time.

Asked at:

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid January, 2025

Meta

Senior

Find non-overlapping 3 intervals of length k to maximize the sum of their elements in a given array

Mid January, 2025

Meta

Senior

Find non-overlapping 3 intervals of length k to maximize the sum of their elements in a given array

Comments

Your account is free and you can post anonymously if you choose.