Search
⌘K
Get Premium
Leetcode 1374. Generate a String With Characters That Have Odd Counts
Return any lowercase string of length n in which every character appears an odd number of times. Key insight: use parity—if n is odd, repeat one letter n times; if n is even, use one letter n−1 times and a different letter once.
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.