Longest Increasing Streak (Set 1)

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 1) — the data. This set runs 4 cases: nums holds arrays of 4–10 items, with values from 1 to 8. The hidden cases are the largest of the set.

Example 1

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

Why

`longestIncreasingStreak` returns `2` for this input.

Example 2

longestIncreasingStreak()
Input
nums = [3, 2, 2, 2]
Output
1

Why

`longestIncreasingStreak` returns `1` 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.