1 class Solution:
 2     def generateTheString(self, n: int) -> str:
 3         if n == 1:
 4             return 'a'
 5         elif n == '2':
 6             return 'ab'
 7         else:
 8             if n % 2 == 0:
 9                 return 'a' * (n-1) + 'b'
10             else:
11                 return 'a' * (n-2) + 'bc'

 

posted on 2020-03-08 13:08  Sempron2800+  阅读(217)  评论(0编辑  收藏  举报