javascript solution


  • 0
    L

    var convertToBase7 = function(num) {
    var a = num
    if(a<0){
    var b = a.toString().split('').slice(1).join('')
    console.log(b)
    return '-' + parseInt(b).toString(7)
    }else{
    return a.toString(7)
    }

    };


Log in to reply
 

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