LeetCode
来源:互联网 发布:拖动拼图验证码js插件 编辑:程序博客网 时间:2024/06/05 20:52
Q:
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28
A:
class Solution(object): def titleToNumber(self, s): """ :type s: str :rtype: int """ value = 0 lenS = len(s) for ch in s: temp = 26 ** (lenS-1) value += (ord(ch) - 64) * temp lenS -= 1 return value
阅读全文
0 0
- leetcode
- [leetcode]
- LeetCode
- leetcode
- leetcode
- leetcode:
- leetcode:
- LeetCode
- leetcode
- LEETCODE
- leetcode
- leetCode
- leetcode
- [leetcode]
- LeetCode
- leetcode
- leetcode:
- leetcode
- UVA11825[Hackers' Crackdown] 动态规划
- 设计安全的账号系统的正确姿势
- AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localho
- android so文件是什么
- 南阳OJ-187
- LeetCode
- Activiti 工作流
- POJ1753 Flip Game(搜索,枚举,位运算压缩)
- 4sum
- elk
- [DP] UVA437
- fashion-mnist
- Java中的链表-----LinkedList<E>泛型类
- Magical Bridges UVALive