Shortest unsorted subarray
Your task
Given an integer array a, find the length of the shortest contiguous subarray that, if sorted in place, would make the entire array sorted in ascending order. If the array is already sorted, return 0.
Examples
shortest_unsorted_subarray(a: list[int]) -> intExample 1
Input
shortest_unsorted_subarray([2, 6, 4, 8, 10, 9, 15])Output
5