Android大法好！！

###### leetCode 38.Count and Say (计数和发言) 解题思路和方法
Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...

1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
Given an integer n, generate the nth sequence.

Note: The sequence of integers will be represented as a string.

public class Solution {
public String countAndSay(int n) {
if(n == 1){
return "1";
}
//递归调用，然后对字符串处理
String str = countAndSay(n-1) + "*";//为了str末尾的标记，方便循环读数
char[] c = str.toCharArray();
int count = 1;
String s = "";
for(int i = 0; i < c.length - 1;i++){
if(c[i] == c[i+1]){
count++;//计数增加
}else{
s = s + count + c[i];//上面的*标记这里方便统一处理
count = 1;//初始化
}
}
return s;
}
}

#### LeetCode38——Count and Say

2015-10-16 20:27:42

#### LeetCode 38 Count and Say（字符串生成）

2017-07-08 08:47:08

#### LeetCode（38） Count and Say

2015-08-26 11:14:38

#### [leetcode]38. Count and Say(java)

2017-01-09 14:19:02

#### LeetCode 38 Count and Say(C,C++,Java,Python)

2015-05-19 21:36:24

#### LeetCode 38 : Count and Say (Java)

2015-12-02 22:50:52

#### LeetCode --- 38. Count and Say

2015-02-05 23:33:41

#### LeetCode38 Count and Say(C语言解决)

2016-11-15 12:13:21

#### LeetCode 38 Count and Say（计数与报数）

2015-12-03 10:32:47

#### LeetCode Count and Say 解题报告

2014-12-05 15:09:28

## 不良信息举报

leetCode 38.Count and Say (计数和发言) 解题思路和方法