Simple 4-line Python Solution


  • 0
    M
        def titleToNumber(self, s):
            column = 0
            for i, l in enumerate(reversed(s)):
                column += (ord(l) - ord('A') + 1) * 26 ** i
            return column
    

Log in to reply
 

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