values. Call a contiguous non-empty span of the array *dropping* if its first element is strictly greater than its last one. What happens in between does not matter.
Return the length of the longest dropping span, or 0 if there is none.
A single-element span is never dropping, since its first and last elements are the same.values=[4, 9, 2, 8, 3, 10] → 5
The span [4, 9, 2, 8, 3] starts at 4 and ends at 3, and 4 > 3. Its length is 5, and nothing longer works: the last element 10 is bigger than every possible start.
values=[2, 2, 5, 7] → 0
No span starts with a value strictly greater than its end, so the answer is 0.
values=[6, 1, 1, 1, 5] → 5
values=[4, 9, 2, 8, 3, 10]
5
Run checks the first 3 tests in your browser. Submit checks all 129 tests on the server, hidden ones included.