Longest Steady Climb
Choose entries of readings, keeping their original order (they do not have to be neighbors), so that every chosen entry is exactly step more than the entry chosen just before it.
Return the largest number of entries you can choose. One entry on its own always qualifies, and an empty list gives 0. step may be zero or negative.
Example 1
readings [1,5,2,7,3,4]
step 1
returns 4
Choose 1, 2, 3 and 4; each is 1 more than the one before.
Example 2
readings [9,4,7,2,5,3,1]
step -2
returns 5
Choose 9, 7, 5, 3 and 1, which keep their order and fall by 2 each time.
Constraints
0 <= len(readings) <= 100-1000 <= readings[i] <= 1000-100 <= step <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.