← Microsoft questions

Longest substring with K unique characters

Filed under Microsoft · Also reported at GAP, Netskope

Given a string, find the length of the longest substring that contains exactly K unique characters.

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.