leetcode --38. Count and Say
来源:互联网 发布:老时时彩遗漏数据 编辑:程序博客网 时间:2024/06/05 05:48
题目:https://leetcode.com/problems/count-and-say/tabs/description
代码:
class Solution {public: string countAndSay(int n) { string temp="1",res; int count; if(n==0) return ""; if(n==1) return "1"; for(int i = 1;i<n;i++){ int len = temp.size(); for(int j=0;j<len;j++){ count = 1; while(temp[j]==temp[j+1]&&j+1<len){ count++; j++; } res+=to_string(count)+temp[j]; } temp=res; res.clear(); } return temp; }};
阅读全文
0 0
- [LeetCode]38.Count and Say
- LeetCode --- 38. Count and Say
- LeetCode 38.Count and Say
- [Leetcode] 38. Count and Say
- 38. Count and Say LeetCode
- Leetcode 38. Count and Say
- leetcode 38. Count and Say
- [leetcode] 38. Count and Say
- LeetCode-38.Count and Say
- LeetCode *** 38. Count and Say
- leetcode 38. Count and Say
- LeetCode-38. Count and Say
- LeetCode 38. Count and Say
- LeetCode 38. Count and Say
- Leetcode - 38. Count and Say
- LeetCode 38. Count and Say
- Leetcode 38. Count and Say
- LeetCode 38. Count and Say
- 斯坦福大学Andrew Ng教授主讲的《机器学习》公开课观后感
- Java高级 反射
- MTK Android Camera 运行流程
- 二分--lower_bound()函数,upper_bound()函数
- 程序出现问题时的调试方法
- leetcode --38. Count and Say
- 深度相机结合cv--solvePnP函数获取定位
- 用js实现算法:冒泡排序、插入排序和快速排序
- vs2008 添加控件变量关联右击控件添加变量是灰色的原因
- 如何避免创业过程中技术相关的“坑”?
- 上传图片过滤掉不是图片格式的文件
- 普及篇:敏捷开发之Scrum?!
- Grandpa's Walk UVALive
- 虚拟币开发专题(钱包编译环境错误解决办法)