Arrays

Shortest Unsorted Continuous Subarray

medium
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.
Hint steps(0/2 revealed)
  1. 1

    Complete previous step or reveal to unlock this hint.

  2. 2

    Complete previous step or reveal to unlock this hint.