leetcode 171 Excel Sheet Column Title

来源:互联网 发布:甘肃网络机柜价格 编辑:程序博客网 时间:2024/04/29 12:30
function getInt2 ($ch) {echo $ch;echo "<br />";$ci = strlen($ch);$sum = 0;for($j=0,$i=$ci-1; $j<$ci; $j++, $i--) {$t = ord( substr($ch, $i, 1) ) - 64;$sum += pow(26, $j) * $t;}echo "SUM = ".$sum;}

leetcode 171, 上面的代码是PHP 的。

Excel Sheet Column Title

Given a column title as appear in an Excel sheet, return its corresponding column number.


0 0
原创粉丝点击