Search
⌘K

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.

Comments

Your account is free and you can post anonymously if you choose.