← Microsoft Interview Insights

Microsoft·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Microsoft coding screen, one question about converting Excel column titles to numbers. Pretty straightforward if you've seen base-26 encoding before, less so if you haven't.

Questions Asked (1)

Q1

Given a string representing an Excel column title (like 'A', 'Z', 'AA', 'AB'), return its corresponding column number.

Algorithms & Data Structures
Author's notes

Looks like a simple base conversion until you realize it's not quite base-26 because there's no zero.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Treat the column title as a base-26 number where 'A' maps to 1 and 'Z' to 26, then process the string from left to right, accumulating the result by multiplying the current total by 26 and adding the value of the current character. This is analogous to converting a hexadecimal string to decimal, but with a 1-indexed alphabet.

Pro tip: Mention that this is essentially a base-26 conversion with a 1-indexed alphabet, and note that the reverse problem (number to title) uses a similar but slightly trickier approach due to the lack of a zero digit. This shows you understand the underlying number system and can handle edge cases.

1. Clarify the mapping

Confirm that 'A' corresponds to 1, 'B' to 2, ..., 'Z' to 26, and that the string is read from left to right with the leftmost character being the most significant digit.

2. Initialize result

Set a variable (e.g., result) to 0 to accumulate the final column number.

3. Iterate through characters

For each character in the string, compute its value as (char - 'A' + 1), then update result = result * 26 + value.

4. Return result

After processing all characters, return the accumulated result as the column number.

5. Analyze complexity

State that the time complexity is O(n) where n is the length of the string, and space complexity is O(1) as only a constant amount of extra space is used.

Key Points to Mention

  • Base-26 number system with a 1-indexed alphabet (A=1, Z=26)
  • Left-to-right processing with multiplication by 26 for each character
  • Character-to-integer conversion using ASCII values (e.g., char - 'A' + 1)
  • Handling of uppercase letters only, as per Excel column titles
  • Time and space complexity analysis
  • Edge cases such as single-character strings and maximum length constraints

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.