1374. Generate a String With Characters That Have Odd Counts

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1374

class Solution:
    def generateTheString(self, n: int) -> str:
        return 'a' * n if n & 1 else 'a' * (n - 1) + 'b'