class Solution(object):
    def countAndSay(self, n):
        """
        :type n: int
        :rtype: str
        """
        s='1'
        for i in range(2,n+1):
            s=self.count(s)
        return s
    def count(self,s):
        t='';count=0;curr='#'
        for i in s:
            if i != curr:
                if curr != '#':
                    t+=str(count)+curr
                curr=i
                count=1
            else:
                count+=1
        t+=str(count)+curr
        return t

@link http://www.cnblogs.com/zuoyuan/p/3781329.html

相关文章:

  • 2021-11-14
  • 2021-08-15
  • 2021-08-11
  • 2021-09-07
  • 2021-10-10
  • 2022-01-04
猜你喜欢
  • 2022-03-04
  • 2022-02-14
  • 2021-07-29
  • 2022-02-05
  • 2021-07-07
  • 2021-10-02
  • 2021-09-10
相关资源
相似解决方案