python beats 100%


  • -1
    G
    class Solution(object):
        def titleToNumber(self, s):
            """
            :type s: str
            :rtype: int
            """
            ans = 0
            for i, k in enumerate(s):
                ans += (ord(k)-64)*26**(len(s)-i-1)
            return ans
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.