Decode Uppercase Spreadsheet Column Titles

Quick Overview

Decode uppercase spreadsheet titles with one-based base-26 digits and the source’s exact title bound.

Decode Uppercase Spreadsheet Column Titles

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Other

### Problem Convert an uppercase spreadsheet column title to its positive column number. Letters represent digits A=1 through Z=26: after Z comes AA=27, AB=28, and so on. ```cpp int titleToNumber(string columnTitle); ``` ### Examples ```text Input: columnTitle = "AZ" Output: 52 ``` ```text Input: columnTitle = "AAA" Output: 703 ``` ### Constraints - Length is between 1 and 7. - Only uppercase English letters occur. - The title lies from A through FXSHRXW in spreadsheet column-number order, inclusive.

Overview: Decode uppercase spreadsheet titles with one-based base-26 digits and the source’s exact title bound.

Google logo
Google
Date not reported
easySoftware EngineerOtherCoding & Algorithms
0
0

Problem

Convert an uppercase spreadsheet column title to its positive column number. Letters represent digits A=1 through Z=26: after Z comes AA=27, AB=28, and so on.

int titleToNumber(string columnTitle);

Examples

Input: columnTitle = "AZ"
Output: 52
Input: columnTitle = "AAA"
Output: 703

Constraints

  • Length is between 1 and 7.
  • Only uppercase English letters occur.
  • The title lies from A through FXSHRXW in spreadsheet column-number order, inclusive.