Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

public bool IsPerfectSquare(int num) { double sqrt = Math.Sqrt(num); return Math.Floor(sqrt)==Math.Ceiling(sqrt); }

Same like ur code :)

public class Solution {

public boolean isPerfectSquare(int num) { double sq=Math.sqrt(num); if(sq%1==0) return true; return false; }

}

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