leetcode -- Count and Say -- 理解题意
来源:互联网 发布:x5效果器调试参数数据 编辑:程序博客网 时间:2024/05/27 09:47
https://leetcode.com/problems/count-and-say/
重点在理解题意。count and say
class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ if n == 1: return "1" else: last = self.countAndSay(n - 1) digit,count = last[0], 0 res = "" for i in xrange(len(last)): if last[i] != digit: res += str(count) + str(digit) digit = last[i] count = 1 else: count += 1 return res + str(count) + str(digit)
0 0
- leetcode -- Count and Say -- 理解题意
- LeetCode: Count and Say
- [LeetCode]Count and Say
- LeetCode Count and Say
- [Leetcode] Count and Say
- Leetcode: Count and Say
- [LeetCode] Count and Say
- LeetCode Count and Say
- [LeetCode]Count and Say
- [LeetCode] Count and Say
- LeetCode-Count and Say
- LeetCode: Count and Say
- LeetCode - Count and Say
- [LeetCode] Count and Say
- Count and Say 【leetcode】
- [LeetCode] Count and Say
- Leetcode Count and Say
- LeetCode Count and Say
- The connection to adb is down, and a severe error has occured.
- qt5 blog.csdn.net/hufanhl
- TCPDUMP 简单使用
- Struts2导出Excel步骤及问题汇总 poi分页
- zabbix数据库items根据vlaue_type选择性存放history相关表
- leetcode -- Count and Say -- 理解题意
- DetachedCriteria详细使用
- webview loadUrl() 弹出系统浏览器解决办法
- 免费云主机
- phpstorm配置Xdebug进行调试PHP教程
- IdentityHashMap
- LightOJ 1061 N Queen Again(状压DP)
- MFC通过COM访问excel出现的几个问题解决方法
- Linux命令nohup