Longest Increasing Streak (Set 10)

Medium

Given an array of integers nums, return the length of the longest run of strictly increasing neighbouring values.

An empty array scores 0; every element counts as a streak of 1.

Longest Increasing Streak (Set 10) — the data. This set runs 4 cases: nums holds arrays of 41–45 items, with values from 1 to 8. The hidden cases are the largest of the set.

Example 1

longestIncreasingStreak()
Input
nums = [1, 4, 7, 3, 3, 5, 4, 2, 2, 6, 6, 4, 5, 6, 5, 5, 3, 3, 1, 8, 7, 1, 6, 4, 1, 1, 4, 1, 6, 5, 2, 3, 7, 8, 1, 6, 6, 7, 5, 6, 6]
Output
4

Why

`longestIncreasingStreak` returns `4` for this input.

Example 2

longestIncreasingStreak()
Input
nums = [1, 5, 5, 6, 1, 7, 4, 6, 8, 4, 6, 5, 3, 2, 8, 1, 8, 4, 6, 8, 5, 8, 1, 5, 3, 5, 4, 7, 6, 4, 8, 4, 4, 7, 8, 2, 4, 7, 4, 5, 4, 8, 5]
Output
3

Why

`longestIncreasingStreak` returns `3` for this input.
Constraints
0 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

ArraysSimulation

Implement longestIncreasingStreak in the editor and return the answer — printing it is never graded.