Pattern Recognition
#13medium

Shortest Subarray to Sort

Given an integer array, find the length of the shortest subarray such that sorting only that subarray makes the entire array sorted. If the array is already sorted, return 0.

Which pattern would you use?

Foundations

Intermediate

Advanced