20%off off — LaunchSpecial
Exercises/#149 Minimum Window to Sort Array
#149

Minimum Window to Sort Array

Hard🔍 Sorting & Searching
135 XP

Problem

Given an integer array, find the shortest subarray that, if sorted, makes the whole array sorted. Return the length.

Examples

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
sorting-searchingarray
AI Assistant— powered by AI

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

149 / 150

Your Solution

⚡ JavaScript

to save progress and use AI features