Given an integer array nums, return the length of the shortest contiguous subarray such that sorting only that subarray in nondecreasing order makes the entire array nums sorted in nondecreasing order. If nums is already sorted in nondecreasing order, return
Note: Follow up: can you solve it in
time complexity?
Constraints:
nums.length
nums[i]
Given an integer array nums, return the length of the shortest contiguous subarray such that sorting only that subarray in nondecreasing order makes the entire array nums sorted in nondecreasing order. If nums is already sorted in nondecreasing order, return
Note: Follow up: can you solve it in
time complexity?
Constraints:
nums.length
nums[i]