Search
⌘K
Get Premium
Leetcode 1417. Reformat The String
Rearrange an alphanumeric string so letters and digits strictly alternate (no two adjacent characters of the same type) and return any valid permutation or an empty string if impossible. This is only possible when the counts of letters and digits differ by at most one, so you must interleave the two groups starting with the more frequent.
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.