One line Python sum solution


  • 0
    S
    def titleToNumber(self, s):
            return sum([26 ** (len(s)-i-1) * (ord(c)-64) for i, c in enumerate(s)])
    

Log in to reply
 

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