easyMathArrays & Hashing

Excel Sheet Column Number

easyTime: O(n)Space: O(1)

Signals to notice

Excel column letters to numberbase-26 with A=1left-to-right accumulation

Brute force first

Not applicable — direct computation.

The key insight

result = result × 26 + (char - 'A' + 1). Process left to right. O(n).

What must stay true

It's base-26 but 1-indexed: A=1, B=2, ..., Z=26. Each position multiplied by 26^distance from right.

Easy way to go wrong

Using A=0 — Excel columns are 1-indexed.

Arrays & Hashing Pattern