3 Line Java Solution


  • 0
    E
    public class Solution {
        public boolean isPerfectSquare(int num) {
            int val=(int)Math.pow(num,0.5);
            val=(int)Math.pow(val,2);
            return val==num?true:false;
        }
    }
    

Log in to reply
 

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