Convert Number to Excel Column

STRING
MATH

Problem

Given an integer columnNumber, return its corresponding Excel sheet column title as it appears in Excel.

For example:

A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...

Examples

convertToTitle(27) // returns "AA" // 27 translates to "AA". convertToTitle(52) // returns "AZ" // 52 corresponds to "AZ". convertToTitle(705) // returns "AAC" // 705 spells out "AAC".
Loading...