Design Gurus Logo
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

. . . .

.....

.....

.....

Unlock this and all other premium problems.
No code editor for this lesson
This lesson focuses on concepts and theory