Shortest unsorted continuous subarray

0
Remix

Find the shortest contiguous subarray that, if sorted, makes the whole array sorted, and return its length. Start from sorting a copy, then find an O(n) two-pointer solution.

AmazonTechnical phone screenLast asked Aug 2025
No answer yet. Write the first one; the best answer gets endorsed.