Longest Steady Climb

EasySliding Window≈ 15 min

A hiker's watch records the altitude at every step in the list readings. A steady climb is a run of readings in a row where each one is strictly higher than the one before it. Return the length of the longest steady climb, counted in readings.

A single reading is a climb of length 1; an empty list has no climb at all, so the answer is 0.

Examples

text
readings = [3, 4, 7, 2, 5, 6, 8, 1]   →  4
readings = [5, 5, 5]                  →  1
readings = [9, 7, 4]                  →  1
readings = [1, 2, 3, 4]               →  4

In the first example 2, 5, 6, 8 rise all the way: 4 readings. In the second, staying at the same altitude is not climbing.

Constraints

  • Between 0 and 20,000 readings, each between -10,000 and 10,000.
  • Aim for O(n): walk the readings once.
Sound off. Turn on for key clicks and a chime when the tests pass.Inline suggestions off. Recommended while you are learning. Turn on to complete words as you type.
Console
›Run to see what your code prints

Run checks the 4 visible cases here, in your browser. Submit runs all 8 on the judge, 4 of them hidden, and measures how your solution scales.