Tap here to switch tabs
Problem
Submissions

Problem: Make Array Non-decreasing

Make Array Non-decreasing gives you an integer array and lets you replace any contiguous subarray with its maximum. Return the greatest length of a non-decreasing array you can obtain.

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 ≤2×105\leq 2 \times 10^5

  • 1≤1 \leq nums[i] ≤2×105\leq 2 \times 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make Array Non-decreasing

Make Array Non-decreasing gives you an integer array and lets you replace any contiguous subarray with its maximum. Return the greatest length of a non-decreasing array you can obtain.

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 ≤2×105\leq 2 \times 10^5

  • 1≤1 \leq nums[i] ≤2×105\leq 2 \times 10^5