Back to course home
0% completed
Vote For New Content
Valid Perfect Square (easy)
Problem Statement
Given a positive integer num
, return true
if num
is a perfect square or false
otherwise.
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
-
- Input: 49
- Expected Output: true
- Justification: (7 * 7) equals 49.
-
- Input: 55
- Expected Output: false
- Justification: There is no integer whose square is 55.
-
- Input: 0
- Expected Output: false
- Justification: 0 is not considered a perfect square.
Constraints:
- 1 <= num <= 2<sup>31</sup> - 1
Try it yourself
Try solving this question here:
Python3
Python3
. . . .
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page
Problem Statement
Examples
Try it yourself