← Questions

Shortest unsorted continuous subarray

0
AmazonCodingLast asked Aug 2025

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.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding