Problem · Math
Excel Sheet Column Title
Learn this problemProblem statement
Given a positive integer columnNumber, return its corresponding Excel-style column title.
The titles use uppercase letters with the sequence A through Z, followed by AA, AB, and so on.
Function
convertToTitle(columnNumber: int) → StringExamples
Example 1
columnNumber = 1return = "A"Column 1 maps to the first letter, A.
Example 2
columnNumber = 28return = "AB"After Z, the sequence continues with AA and then AB.
Example 3
columnNumber = 701return = "ZY"The bijective base-26 digits are Z and Y.
Constraints
1 <= columnNumber <= 2^31 - 1