← Microsoft questions

Sort 0s, 1s, and 2s and Number of Islands

Filed under Microsoft

Write code to sort an array containing only 0s, 1s, and 2s (Dutch National Flag problem), and write code to find the number of islands in a 2D grid using Depth-First Search (DFS).

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.