← ALL NOTES
Array

3105. Longest Strictly Increasing or Strictly Decreasing Subarray

Given nums, find the length of the longest contiguous subarray that is strictly increasing OR strictly decreasing. Track two run lengths in one pass — the current increasing and decreasing streaks.

Loading…