python3 solution

  • 0

    My python3 solution by using ascii code.

    class Solution:
        def titleToNumber(self, s):
            :type s: str
            :rtype: int
            ctr = len(s)-1
            n = 0
            for c in s:
                n += (ord(c)-64)*(26**ctr)
            return n

Log in to reply

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