Premium Only Content

1574. Shortest Subarray to be Removed to Make Array Sorted
Given an integer array arr, remove a subarray (can be empty) from arr such that the remaining elements in arr are non-decreasing.
Return the length of the shortest subarray to remove.
A subarray is a contiguous subsequence of the array.
Example 1:
Input: arr = [1,2,3,10,4,2,3,5]
Output: 3
Explanation: The shortest subarray we can remove is [10,4,2] of length 3. The remaining elements after that will be [1,2,3,3,5] which are sorted.
Another correct solution is to remove the subarray [3,10,4].
Example 2:
Input: arr = [5,4,3,2,1]
Output: 4
Explanation: Since the array is strictly decreasing, we can only keep a single element. Therefore we need to remove a subarray of length 4, either [5,4,3,2] or [4,3,2,1].
Example 3:
Input: arr = [1,2,3]
Output: 0
Explanation: The array is already non-decreasing. We do not need to remove any elements.
-
LIVE
The Jimmy Dore Show
24 minutes agoTrump Administration Sends Accused Pedo BACK TO ISRAEL! Ukrainians Now OVERWHELMINGLY Oppose War!
3,639 watching -
DVR
TheCrucible
2 hours agoThe Extravaganza! Ep. 24 (8/20/25)
14.3K1 -
Kim Iversen
2 hours agoUFO Base Area 51 Catches Fire… Is It a Massive Cover-Up?!
5.04K21 -
1:51:18
Redacted News
2 hours ago"There will be consequences!!!" Trump issues big threat to Putin ahead of peace summit | Redacted
66.6K37 -
53:14
Candace Show Podcast
2 hours agoThe MOST MORAL Blackmail In The World | Candace EP 231
18.8K51 -
1:11:28
vivafrei
3 hours agoMatt Taibbi Getting "Westfalled"? Kathy Hochul Fighting for Illegals! Mamdani Minority Report & MORE
70K28 -
2:03:39
Pop Culture Crisis
4 hours agoWTF Happened to Miley Cyrus? HARRY POTTER Set Images, Sydney Sweeney Hater EXPOSED | Ep. 901
18.4K17 -
10:17
MattMorseTV
4 hours ago $5.37 earnedTrump's DOJ just DROPPED a NUKE.
23.8K30 -
11:07
Politibrawl
12 days agoRepublican rising star DESTROYS theatrical Democrat in front of the entire world
66.7K28 -
DVR
StoneMountain64
5 hours agoOnly game with BETTER desctruction than Battlefield?
45.7K