Javascript solution in 5 lines

  • 0

    The idea is determine by sqrt of c-a*a is a integer or not

    var judgeSquareSum = function(c) {
        for(var i=Math.floor(Math.sqrt(c));i>=0;i--){
                return true        
        return false

Log in to reply

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