Tap here to switch tabs
Problem
Submissions

Problem: Longest Strictly Increasing or Decreasing Subarray

med
30 min
Try to solve the Longest Strictly Increasing or Decreasing Subarray problem.

Statement

Given an integer array nums, return the maximum length of a contiguous subarray that is either strictly increasing or strictly decreasing.

A subarray is strictly increasing if every element is greater than the previous element. A subarray is strictly decreasing if every element is less than the previous element.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Strictly Increasing or Decreasing Subarray

med
30 min
Try to solve the Longest Strictly Increasing or Decreasing Subarray problem.

Statement

Given an integer array nums, return the maximum length of a contiguous subarray that is either strictly increasing or strictly decreasing.

A subarray is strictly increasing if every element is greater than the previous element. A subarray is strictly decreasing if every element is less than the previous element.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤50\leq 50