one line java cheese solution


  • -1
    J
    public class Solution {
        public boolean isPerfectSquare(int num) {
            return ((Math.sqrt(num)) % 1 == 0) ? true : false;
        }
    }
    

  • 0
    G

    The specification of this problem said "Do not use any built-in library function such as sqrt"


Log in to reply
 

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