Tap here to switch tabs
Problem
Submissions

Problem: Longest Non-Decreasing Subarray After One Replacement

Try to solve the Longest Non-Decreasing Subarray After Replacing at Most One Element problem.

Statement

You are given an integer array nums.

You are allowed to replace at most 11 element in nums with any integer value.

Return the maximum length of a contiguous non-decreasing subarray that can be obtained after performing at most 11 replacement.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Non-Decreasing Subarray After One Replacement

Try to solve the Longest Non-Decreasing Subarray After Replacing at Most One Element problem.

Statement

You are given an integer array nums.

You are allowed to replace at most 11 element in nums with any integer value.

Return the maximum length of a contiguous non-decreasing subarray that can be obtained after performing at most 11 replacement.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9