168 Excel Sheet Column Title – Easy
Problem:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> ABThoughts:
Solutions:
public class Solution {
public String convertToTitle(int n) {
String result = "";
while (n != 0) {
int tmp = (n - 1) % 26;
result = (char)('A' + tmp) + result;
n = (n - 1)/ 26;
}
return result;
}
}Last updated