Convert a Column Number to an Excel-Style Label
Company: Houzz
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Online Assessment
Overview: Convert one-based spreadsheet columns into A-through-Z and AA-through-ZZ labels, with correct handling of multiples of 26.
Read the full Houzz Software Engineer interview experience this question came from
Constraints
- n is an integer from 1 through 702 inclusive.
- Return only uppercase column letters; do not include a row.
- Numbering is one-based and has no zero digit.
- Inputs are valid; out-of-range error behavior is outside the contract.
Examples
Input: (26,)
Expected Output: 'Z'
Explanation: Last single-letter label.
Input: (27,)
Expected Output: 'AA'
Explanation: First two-letter label.
Hints
- Check labels on each side of a 26-column boundary.