Available question text
Find a contiguous subarray whose first and last elements differ by exactly k and return the maximum possible subarray sum (or 0 if none). With n up to 1e5, the typical O(n) approach scans the array using prefix sums and a map that remembers the best starting prefix for each value to evaluate candidate ends.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Meta
Leetcode 3026. Maximum Good Subarray Sum
Reported May 28, 2026 · 1 source report
SENIOR
Source snapshot: Nov 12, 2026
View source