← Questions
Shortest substring with N distinct characters
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given a string and a number n, return the shortest substring that contains n distinct letters (or say that none exists). Use a sliding window that grows until it holds n distinct letters and then shrinks from the left. The round gave about twenty minutes for it.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
