美文网首页
Leetcode38-Count and Say(Python3

Leetcode38-Count and Say(Python3

作者: LdpcII | 来源:发表于2017-09-13 15:06 被阅读0次

38. Count and Say

The count-and-say sequence is the sequence of integers with the first five terms as following:

1.    1

2.    11

3.    21

4.    1211

5.    111221

1is read off as"one 1"or11.

11is read off as"two 1s"or21.

21is read off as"one 2, thenone 1"or1211.

Given an integern, generate thenthterm of the count-and-say sequence.

Note: Each term of the sequence of integers will be represented as a string.

Example 1:

Input:1Output:"1"

Example 2:

Input:4Output:"1211"

My Solution

参考答案(转)

相关文章

网友评论

      本文标题:Leetcode38-Count and Say(Python3

      本文链接:https://www.haomeiwen.com/subject/oyzksxtx.html