Excel Sheet Column Number -- leetcode
2015-06-24 19:41
190 查看
Related to question
Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
Excel Sheet Column Title
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
class Solution { public: int titleToNumber(string s) { int ans = 0; for (auto ch : s) { ans = ans * 26 + ch - 'A' + 1; } return ans; } };
相关文章推荐
- json, protobuf-c++,pbc,sproto 性能测试与解决方案
- iphone使用开源代码Asyncsocket进行socket编程
- inno setup安装包程序完整版
- Android字符串及字符串资源的格式化
- sql server 日期范围
- NSFileManager和NSFileHandle
- Android Bundle类
- 统计多个wav文件的总音频时长
- 基本文件操作:NSFileHandle的用法
- ALV 中根据条件设置某个cell 是否可编辑
- Alex 的 Hadoop 菜鸟教程: 第20课 工作流引擎 Oozie
- codeforces 544D Destroying Roads (最短路)
- Leetcode 220 Contains Duplicate III
- AVAudioPlayer常用属性
- linux学习(之二)-初识linux的一些常用命令
- ural 1016 Cube on the Walk
- NSBundle的使用,注意mainBundle和Custom Bundle的区别
- virtual Box更换虚拟硬盘位置并设置网络连接
- linux程序设计——执行SQL语句(第八章)
- WPF让button响应按键