Trains the technique from
LeetCode 674Longest Continuous Increasing SubsequenceThis 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 river gauge writes one water level per hour into readings, in the order the levels were taken. Levels are whole numbers and may be negative when the water is below the gauge's mark.
A rising run is a block of neighbouring entries readings[i] through readings[j] in which every entry is strictly greater than the entry just before it inside the block. A block of one entry counts as a rising run, and two equal entries side by side cannot be in the same run.
Return the number of entries in the longest rising run of readings.
Example 1
The block `3, 6, 8, 20` at the end holds four entries and each is strictly above the one before it, so it is a rising run of four.
Example 2
Every entry is below the one before it, so no block of two entries rises and each single entry is a run of one.
Example 3
The two equal entries of `6` cannot share a run, so the run ending at the last entry starts at the second `6` and holds `6, 7, 8, 9`.
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 longest_rising_run(readings: list[int]) -> int:public int longestRisingRun(int[] readings)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.