Given an integer array, find the shortest subarray that, if sorted, makes the whole array sorted. Return the length.
Input: nums = [2,6,4,8,10,9,15] Output: 5 (subarray [6,4,8,10,9]) Input: nums = [1,2,3,4] Output: 0
Unlock hints progressively — start gentle, go deeper only if needed.
Level 1: Gentle Nudge
A subtle direction
Level 2: Approach
The algorithm to use
Level 3: Detailed
Step-by-step guidance
to save progress and use AI features