Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 340. Longest Substring with At Most K Distinct Characters
Given a string and an integer K, find the length of the longest substring that contains at most K distinct characters. This is typically solved by maintaining a variable-size sliding window and a character frequency map to expand and shrink while keeping the distinct-count constraint.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.