【LeetCode】Count and Say
2014-12-10 16:22
239 查看
string convert(string str) { stringstream ss; int i,count=0; char last=str[0]; for(i=0;i<=str.size();i++) { if(str[i]==last) { count++; } else { ss<<count<<last; count=1; last=str[i]; } } return ss.str(); } string countAndSay(int n) { string output; output="1"; for(int i=1;i<n;i++) { output=convert(output); } return output; }
相关文章推荐
- LeetCode Count and Say
- 【LeetCode】Count and Say
- [LeetCode]Count and Say
- leetcode之路038 Count and Say
- leetcode Count and Say
- LeetCode: count and say
- LeetCode(38) Count and Say
- Count and Say 【leetcode】
- [leetcode]_Count and Say
- LEETCODE: Count and Say
- [LeetCode]Count and Say
- [leetcode-38]count and say(java)
- 【Leetcode】Count and Say
- [LeetCode]38 Count and Say
- Leetcode - Count and Say
- leetcode第17题----- Count and Say
- LeetCode(51)- Count and Say
- leetcode-38-Count and Say 基础题
- Leetcode之Count and Say 问题
- LeetCode(38)--Count and Say