Spreadsheet columns are labelled A, B, ..., Z, AA, AB, ..., AZ, BA, ..., ZZ, AAA, ..., and numbered 1, 2, 3, ... in the same order. Write column(x) that converts in whichever direction is needed: if x is a positive integer, return its label as a string; if x is a label string of uppercase letters, return its number as an integer.
Examples
Input: x = 28
Output: "AB"
Input: x = "AB"
Output: 28
Explanation: A contributes 1 * 26 and B contributes 2.
Constraints
1 <= number <= 10**9; labels are non-empty and uppercase.- Target: O(length of the label) time.
Goals
- Recognise bijective base 26 (digits 1..26, no zero)
- Convert a label to a number with a running accumulator
- Convert a number to a label by adjusting before each divmod