Skip to content

Practice Valid Perfect Square

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#367
LeetCode Problem

Valid Perfect Square

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.

Source: Valid Perfect Square on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
num = 16
Output
true

# Example 2

Input
num = 14
Output
false

Constraints

1 <= num <= 2^31 - 1

Related LeetCode Problems

Practice more problems similar to Valid Perfect Square.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.