Tap here to switch tabs
Problem
Submissions

Problem: Shortest Subarray to be Removed to Make Array Sorted

med
30 min
Try to solve the Shortest Subarray to be Removed to Make Array Sorted problem.

Statement

Given an integer array arr, determine the length of the shortest contiguous subarray that can be removed such that the remaining elements are in nondecreasing order.

Note: A subarray is a contiguous sequence of elements within an array.

Constraints:

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

  • 0≤0 \leq arr[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Shortest Subarray to be Removed to Make Array Sorted

med
30 min
Try to solve the Shortest Subarray to be Removed to Make Array Sorted problem.

Statement

Given an integer array arr, determine the length of the shortest contiguous subarray that can be removed such that the remaining elements are in nondecreasing order.

Note: A subarray is a contiguous sequence of elements within an array.

Constraints:

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

  • 0≤0 \leq arr[i] ≤109\leq 10^9