1574. Shortest Subarray to be Removed to Make Array Sorted
https://leetcode.com/problems/shortest-subarray-to-be-removed-to-make-array-sorted
Description
Given an integer array arr
, remove a subarray (can be empty) from arr
such that the remaining elements in arr
are non-decreasing.
A subarray is a contiguous subsequence of the array.
Return the length of the shortest subarray to remove.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= arr.length <= 10^5
0 <= arr[i] <= 10^9
ac
Last updated