Skip to content

Instantly share code, notes, and snippets.

@Choongkyu
Created August 10, 2020 20:19
Show Gist options
  • Select an option

  • Save Choongkyu/d4f7dc19fcfa49b4842041352b037983 to your computer and use it in GitHub Desktop.

Select an option

Save Choongkyu/d4f7dc19fcfa49b4842041352b037983 to your computer and use it in GitHub Desktop.

Revisions

  1. Zebralight created this gist Aug 10, 2020.
    8 changes: 8 additions & 0 deletions excel_col_num.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    class Solution:
    def titleToNumber(self, s: str) -> int:
    out = 0
    for i, ch in enumerate(s):
    v = ord(ch) - 64
    place = len(s) - i - 1
    out += (v * 26**place)
    return out