Count and Say
来源:互联网 发布:学生赚软件下载 编辑:程序博客网 时间:2024/06/06 19:37
class Solution {public: string countAndSay(int n) { if(n<=0) return ""; string result="1"; for(int i=2;i<=n;++i) { string temp=""; int start=0; int end=0; for(int j=1;j<result.size();++j) { if(result[j]==result[j-1]) { end=j; } else { temp+=to_string(end-start+1)+result[j-1]; start=j; end=j; } } temp+=to_string(end-start+1)+result[end]; result=temp; } return result; }};
0 0
- LeetCode: Count and Say
- [LeetCode]Count and Say
- LeetCode Count and Say
- [Leetcode] Count and Say
- Count and Say
- Leetcode: Count and Say
- [LeetCode] Count and Say
- LeetCode Count and Say
- Count and Say
- [38]Count and Say
- Count and Say
- Count and Say
- Count and Say
- [LeetCode]Count and Say
- Count and Say
- Count and Say
- [LeetCode] Count and Say
- LeetCode-Count and Say
- MVC3 自带数据验证
- HBase 系统架构
- JAVA 反射 总结 之 初级 (一)
- 用matlab程序实现求解三次样条插值
- android 笔记
- Count and Say
- Tomcat Maven插件持续快捷部署Web项目
- MATLAB学习笔记(四)
- 15第十一周项目二——职员有薪水了(1)
- IOS开发之实现App消息推送(IOS 8)
- libev的入门笔记(基本使用)
- 第9周项目4-我的向量类
- C++ mkdir 创建多级文件夹目录
- 第十一周上机实践项目2——职员有薪水了(1)