mirror of
https://github.com/arkorty/LeetCode.git
synced 2026-03-17 16:51:46 +00:00
10 lines
241 B
Java
10 lines
241 B
Java
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;
|
|
}
|
|
}
|