Tap here to switch tabs
Problem
Submissions

Problem: Make Array Non-decreasing

med
30 min
Try to solve the Make Array Non-decreasing problem.

Statement

You are given an integer array nums.

In one operation, you can select any contiguous subarray of nums and replace it with its maximum element.

Return the maximum possible length of an array sorted in non decreasing order that can be obtained by performing this operation any number of times.

Constraints:

  • 1≤1 \leq nums.length ≤2imes105\leq 2 imes 10^5

  • 1≤1 \leq nums[i] ≤2imes105\leq 2 imes 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make Array Non-decreasing

med
30 min
Try to solve the Make Array Non-decreasing problem.

Statement

You are given an integer array nums.

In one operation, you can select any contiguous subarray of nums and replace it with its maximum element.

Return the maximum possible length of an array sorted in non decreasing order that can be obtained by performing this operation any number of times.

Constraints:

  • 1≤1 \leq nums.length ≤2imes105\leq 2 imes 10^5

  • 1≤1 \leq nums[i] ≤2imes105\leq 2 imes 10^5