Python concise and elegant solution


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