Python concise solution.


  • 2
    C
    def titleToNumber(self, s):
        res = 0
        for i in s:
            res = res*26 + ord(i)-ord('A')+1
        return res

Log in to reply
 

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