A simple C solution [Accepted]


  • 0
    B
    bool isPerfectSquare(int num) {
        if(num<2)
        {return true;}
        for(int i=num/2;i>0;i--)
        {
            if(i*i==num)
            {return true;}
        }
        return false;
    }
    

Log in to reply
 

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