Excel Sheet Column Title

Published by Evgeny SH in

Given a positive integer, return its corresponding column title displayed in Excel sheets.

For example:

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

Examples

convert_to_title(1) ➞ "A"

convert_to_title(18) ➞ "R"

convert_to_title(28) ➞ "AB"

convert_to_title(52) ➞ "AZ"

convert_to_title(701) ➞ "ZY"

Notes

N/A

Watch a quick demo on how Edabit works.