171-Excel-Sheet-Column-Number

Sat 17 May 2025

https://leetcode.com/problems/excel-sheet-column-number

import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
  def titleToNumber(self, s: str) -> int:
    ans = 0

    for c in s:
      ans = ans * 26 + ord(c) - ord('@')

    return ans
new Solution().titleToNumber()

Score: 5

Category: leetcode