My Java 0 ms Solution with String


  • 0
    H
    public String convertToTitle(int n) {
        String title = "";
        while(n>0){
            n--;
            title = (char)('A'+ n%26) + title;
            n /= 26;
        }
        return title;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.