Python one line beats 100.00% of pythonsubmissions


  • 0
    P

    class Solution(object):
    def titleToNumber(self, s):
    """
    :type s: str
    :rtype: int
    """
    return sum(list((26 ** (len(s) - i - 1)) * (ord(s[i]) - 64) for i in range(len(s))))


Log in to reply
 

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