less than 1 minute read

Spreadsheets often use this alphabetical encoding for its columns: "A", "B", "C", …, "AA", "AB", "AC", …, "ZZ", "AAA", "AAB", "AAC", ….

Given a string s representing an alphabetical column id, return its column number. For example, given "A", return 1. Given "AA", return 27.

https://binarysearch.com/problems/The-Auditor

Examples

Example 1

Input

  • s = AA

Output

  • answer = 27

Solution

Categories:

Updated:

Leave a comment