Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 342 Bytes

1374.md

File metadata and controls

15 lines (13 loc) · 342 Bytes

1374. Generate a String With Characters That Have Odd Counts

Solution 1 (time O(1), space O(1))

class Solution(object):
    def generateTheString(self, n):
        """
        :type n: int
        :rtype: str
        """
        if n % 2 == 0:
            return "a" * (n - 1) + "b"
        return "a" * n