Perfect Square
MATH
Problem
Given a positive integer num
, check whether it is a perfect square. A perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself.
You must not use any built-in library function such as sqrt.
Examples
isPerfectSquare(25) // returns true // 25 forms a perfect square because 5 * 5 = 25. isPerfectSquare(36) // returns true // 36 forms a perfect square because 6 * 6 = 36. isPerfectSquare(15) // returns false // No integer multiplied by itself gives a wave height of 15.
Loading...