# Time:  O(n)
# Space: O(1)
#
# Related to question Excel Sheet Column Title
# 
# Given a column title as appear in an Excel sheet, return its corresponding column number.
# 
# For example:
# 
#     A -> 1
#     B -> 2
#     C -> 3
#     ...
#     Z -> 26
#     AA -> 27
#     AB -> 28 
#

class Solution:
    # @param s, a string
    # @return an integer
    def titleToNumber(self, s):
        result = 0
        for i in xrange(len(s)):
            result *= 26
            result += ord(s[i]) - ord('A') + 1
        return result

if __name__ == "__main__":
    print Solution().titleToNumber("AAAB")
@@ -21,17 +21,16 @@
 e: O(1)%0A
-#
 %0A# Relat
@@ -278,18 +278,16 @@
 B -%3E 28 
-%0A#
 %0A%0Aclass 
@@ -298,91 +298,114 @@
 tion
-:%0A    # @param s, a
+(object):%0A    def titleToNumber(self, s):%0A        %22%22%22%0A        :type s:
  str
-ing
 %0A    
-# @return an integer%0A    def titleToNumber(self, s):
+    :rtype: int%0A        %22%22%22
 %0A   
@@ -548,16 +548,17 @@
 result%0A%0A
+%0A
 if __nam
@@ -618,8 +618,9 @@
 (%22AAAB%22)
+%0A

Update excel-sheet-column-number.py