FastPrepExcel Sheet Column Title
Problem · Math

Excel Sheet Column Title

Learn this problem
EasyUiPath logoUiPathFULLTIMEPHONE SCREEN

Problem 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) → String

Examples

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
drafts saved locally
public String convertToTitle(int columnNumber) {
    // write your code here
}
columnNumber1
expected"A"
checking account