Trains the technique from
LeetCode 1800Maximum Ascending Subarray SumThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A strip of positive readings reads readings. A run of neighbouring readings rises when each of its readings is strictly larger than the one before it; a run of a single reading rises by default.
Return the largest total any rising run adds up to.
Example 1
The first three readings rise and add to six. The last reading breaks the run and stands alone at one.
Example 2
No reading is strictly larger than the one before, so every rising run holds a single reading.
Example 3
The 9 stands alone at nine, while the rising run 4 then 5 adds only to nine as well, so nine is the answer either way.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def max_ascending_sum(readings: list[int]) -> int:public int maxAscendingSum(int[] readings)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.