Can someone tell me what's wrong with my code?


#1

public class Solution {
public String convertToTitle(int A) {
String s="";
while(A!=0)
{
char c=(char)(A%26+64);
s=c+s;
A/=26;
}
return s;
}
}


#2

When A is divisible by 26 ,according to your code the value of c will be (char)64 which is not an alphabet . so update your code when A%26==0 .
Happy coding :slight_smile: