Available question text
For each prefix nums[0..i], compute the score defined as the sum over j<=i of (nums[j] + max(nums[0..j])); the core task is to output these scores for all prefixes efficiently. Key insight: maintain a running prefix sum and the cumulative sum of prefix-maximums (which only changes when a new larger element appears) to produce all answers in O(n) for n up to 1e5.
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
No company association
Leetcode 2640. Find the Score of All Prefixes of an Array
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source