Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2904. Shortest and Lexicographically Smallest Beautiful String
Given a binary string s and integer k, find the shortest substring that contains exactly k '1's and return the lexicographically smallest such substring (or empty if none). This can be solved by examining windows spanning k consecutive '1's and choosing the minimum-length window with lexicographic tie-breaking.
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.