Created
August 10, 2020 20:19
-
-
Save Choongkyu/d4f7dc19fcfa49b4842041352b037983 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def titleToNumber(self, s: str) -> int: | |
out = 0 | |
for i, ch in enumerate(s): | |
v = ord(ch) - 64 | |
place = len(s) - i - 1 | |
out += (v * 26**place) | |
return out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment