A JavaScript Solution


  • 0
    S

    Maybe it is a little clumsy.. ./;w;\

    var a = '0ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        a = a.split('');
    var convertToTitle = function(n) {
        if(n < 27) {
            return a[n];
        } else {
            var temp = Math.ceil(n / 26)-1;
            return convertToTitle(temp) + convertToTitle(n - temp*26);
        }
    };
    

Log in to reply
 

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