mirror of
https://github.com/arkorty/LeetCode.git
synced 2026-03-18 00:57:17 +00:00
Initial commit
This commit is contained in:
9
Easy/excel-sheet-column-number/Solution.java
Normal file
9
Easy/excel-sheet-column-number/Solution.java
Normal file
@@ -0,0 +1,9 @@
|
||||
class Solution {
|
||||
public int titleToNumber(String ttl) {
|
||||
int num = 0;
|
||||
for (int i = 0; i < ttl.length(); i++)
|
||||
num += Math.pow(26, i) * (int) (ttl.charAt(ttl.length() - i - 1) - 64);
|
||||
|
||||
return num;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user