less than 1 minute read

Given an integer n, return whether n = k * k for some integer k.

This should be done without using built-in square root function.

Constraints

  • 0 ≤ n < 2 ** 31

https://binarysearch.com/problems/Check-if-Number-Is-Perfect-Square

Examples

Example 1

Input

  • n = 25

Output

  • answer = True

Explanation

25 = 5 * 5

Solution

Leave a comment