<reponame>Sourav692/FAANG-Interview-Preparation<filename>Algo and DSA/LeetCode-Solutions-master/Python/generate-a-string-with-characters-that-have-odd-counts.py
# Time:  O(n)
# Space: O(1)

class Solution(object):
    def generateTheString(self, n):
        """
        :type n: int
        :rtype: str
        """
        result = ['a']*(n-1)
        result.append('a' if n%2 else 'b')
        return "".join(result)

and DSA/LeetCode-Solutions-master/Python/generate-a-string-with-characters-that-have-odd-counts.py
# Time:  O(n)
# Space: O(1)

class Solution(object):
    def generateTheString(self, n):
        """
        :type n: int
        :rtype: str
        """
        result = ['a']*(n-1)
        result.append('a' if n%2 else 'b')
        return "".join(result)
# Time:  O(n) # Space: O(1) :type n: int         :rtype: str