LeetCode 171 Excel Sheet Column Number
Problem:
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
Summary:
将二十六进制数字转为十进制。
Analysis:
class Solution {
public:
int titleToNumber(string s) {
int len = s.size();
int res = ;
for (int i = ; i < len; i++) {
res += (s[len - i - ] - 'A' + ) * pow(, i);
}
return res;
}
};
LeetCode 171 Excel Sheet Column Number的更多相关文章
- [LeetCode] 171. Excel Sheet Column Number 求Excel表列序号
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, retur ...
- LeetCode 171. Excel Sheet Column Number (Excel 表格列数字)
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, retur ...
- ✡ leetcode 171. Excel Sheet Column Number 字母转换为数字 --------- java
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, retur ...
- Java for LeetCode 171 Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, retur ...
- LeetCode: 171 Excel Sheet Column Number(easy)
题目: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, r ...
- Leetcode 171 Excel Sheet Column Number python
题目: Given a column title as appear in an Excel sheet, return its corresponding column number. For ex ...
- 20. leetcode 171. Excel Sheet Column Number
Given a column title as appear in an Excel sheet, return its corresponding column number. For exampl ...
- LeetCode 171 Excel Sheet Column Number 解题报告
题目要求 Given a column title as appear in an Excel sheet, return its corresponding column number. For e ...
- Leetcode 171 Excel Sheet Column Number 难度:0
https://leetcode.com/problems/excel-sheet-column-number/ class Solution { public: int titleToNumber( ...
随机推荐
- ngCordova插件安装使用
为什么ngCordova ngCordova是在Cordova Api基础上封装的一系列开源的AngularJs服务和扩展,让开发者可以方便的在HybridApp开发中调用设备能力,即可以在Angul ...
- HtmlAgilityPack解析器在WP8.1下报错,不仅如此,社交化分享也报错。
以前WP7下是用的HtmlAgilityPack和 XPath来解析网页,很好用. 但是在Wp8.1下,这个里面却缺少了一个很重要的方法. HtmlDocument doc = new HtmlDoc ...
- Ruby基本语法规则
1.Ruby常用数据类型 Numbers, Strings, Booleans my_num = 25 my_boollean = true (or false) my_string = " ...
- soj4271 Love Me, Love My Permutation (DFS)
4271: Love Me, Love My Permutation Description Given a permutation of n: a[0], a[1] ... a[n-1], ( it ...
- 隐藏NavigationBar时的一个坑
http://www.jianshu.com/p/efb960fed457 - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear: ...
- 1-File类的使用
package com.io; import java.io.File; import java.io.FileInputStream; import java.io.IOException; imp ...
- mac 下载安装 IntelliJ IDEA Tomcat
(1)Download IntelliJ IDEA https://www.jetbrains.com/idea/download/ (2)找了个激活码 http://www.oschina.net/ ...
- leetcode 236. Lowest Common Ancestor of a Binary Tree
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According ...
- linux 文件系统sysvinit 流程分析
参考网上许多的教程. 然后有一下相关的笔记: kernel 在挂载完文件系统后,会执行第一个进程init 这个进程的PID为1 这个进程是所有进程的父进程 init 进程,首先要去读取inittab中 ...
- vSphere、Hyper-V与XenServer 你选哪个?
vSphere.Hyper-V与XenServer 你选哪个? 当在VMware vSphere.Microsoft Hyper-V与Citrix Systems XenServer之间做出选择时,v ...