1
2
3
4
5
6
|
class Solution:
def titleToNumber(self, columnTitle: str) -> int:
ans=0
for i in range(len(columnTitle)):
ans+= pow(26,len(columnTitle)-i-1)*int (ord( columnTitle[i])-64)
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
Leetcode 88. Merge Sorted Array (0) | 2021.07.15 |
---|---|
Leetcode 771. Jewels and Stones (0) | 2021.07.15 |
Leetcode 50. Pow(x, n) (0) | 2021.07.15 |
Leetcode 43. Multiply Strings (0) | 2021.07.15 |
Leetcode 29. Divide Two Integers (0) | 2021.07.15 |
댓글