20%off off — LaunchSpecial
Exercises/#64 Sort Colors (Dutch National Flag)
#64

Sort Colors (Dutch National Flag)

Medium🔍 Sorting & Searching
70 XP

Problem

Given an array with values 0, 1, 2 (representing red, white, blue), sort them in-place without using sort().

Examples

Input: nums=[2,0,2,1,1,0]
Output: [0,0,1,1,2,2]
sortingtwo-pointerin-place
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

64 / 150

Your Solution

⚡ JavaScript

to save progress and use AI features