My LeetCode grinding. Trying to do a problem a day.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910
  1. class Solution:
  2. def generateTheString(self, n: int) -> str:
  3. if n % 2 == 0:
  4. return ('a' * (n -1)) + 'b'
  5. else:
  6. return 'a' * n
  7. s = Solution()
  8. print("Expected: 'aaab'")
  9. print("Got:", s.generateTheString(4))