Shortest Unsorted Continuous Subarray — JavaScript medium interview problem
Given an integer array `nums`, you need to find one continuous subarray such that if you only sort this subarray in ascending order, the whole array will be sorted. Return the length of the shortest such subarray. Return 0 if already sorted.
Tags: two-pointers
Practice this Arrays problem free in the JS Interview Playground with automated tests and unlockable solutions.