← ALL NOTES
String

2904. Shortest and Lexicographically Smallest Beautiful String

The shortest window with exactly k ones has to begin and end with a 1 — a leading or trailing zero is dead weight I can trim to get shorter or lexicographically smaller.

Loading…