Description
Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. For example, 1=A, 2=B, 26=Z, 27=AA, 28=AB, etc.
Examples
Input:
columnNumber = 28Output:
"AB"Explanation:
28 converts to 'AB' using base-26 encoding: 28 = 1×26 + 2, where 1 maps to 'A' and 2 maps to 'B'.
Input:
columnNumber = 1Output:
"A"Explanation:
Column 1 corresponds to the letter 'A'.
Input:
columnNumber = 52Output:
"AZ"Explanation:
52 corresponds to the column title "AZ". After Z (26), the sequence continues with AA (27), AB (28), and so on until AZ (52).
Constraints
- •
1 ≤ columnNumber ≤ 2³¹ - 1