LeetCode 171, Easy. Topics: Math, String. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 20 parametrized pytest cases, and a playground notebook:
Problem
Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column number.
For example:
Examples
Constraints
- 1 <= columnTitle.length <= 7
- columnTitle consists only of uppercase English letters.
- columnTitle is in the range [“A”, “FXSHRXW”].
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
Last modified on September 7, 2026