Available question text
Compute the sum of (maximum - minimum) over all contiguous subarrays of a given integer array. The challenge is to do this faster than brute force by counting each element's contribution as subarray maximum and minimum (can be achieved in O(n) with monotonic-stack techniques).
Related questions
Continue with questions that share topics or the same question type.
- Continuous Subarray Sum
Coding
- Divide an array into subarray with equal sum.
Coding
- Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Walk through Kadane's algorithm and explain the O(n) approach.
Coding
- Kth Smallest Subarray Sum
Coding
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 2104. Sum of Subarray Ranges
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source