Skip to content

Commit 3db8f50

Browse files
committed
📈(LEETCODE) Excel Sheet Column
1 parent 19af2b0 commit 3db8f50

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution
2+
{
3+
public:
4+
int titleToNumber(string s)
5+
{
6+
int ans = 0;
7+
for (int i = 0; i < s.length(); i++)
8+
{
9+
ans += (s[i] - 'A' + 1) * pow(26, s.length() - i - 1);
10+
}
11+
return ans;
12+
}
13+
};

0 commit comments

Comments
 (0)