Loading content...
Given a positive integer num, determine whether it represents a complete square — that is, whether there exists another integer whose product with itself equals num.
A complete square (also known as a square number) is formed when an integer is multiplied by itself. For instance, 1, 4, 9, 16, 25, and 36 are complete squares because they equal 1×1, 2×2, 3×3, 4×4, 5×5, and 6×6 respectively.
Return true if num is a complete square, and false otherwise.
Important Constraint: You are prohibited from using any built-in library functions that compute square roots (such as sqrt, Math.sqrt, pow, or equivalent). Your solution must rely solely on fundamental arithmetic operations and logical constructs.
num = 16trueThe number 16 is a complete square because 4 × 4 = 16, where 4 is an integer.
num = 14falseThe number 14 is not a complete square. The square root of 14 is approximately 3.742, which is not an integer. No integer multiplied by itself produces 14.
num = 9trueThe number 9 is a complete square because 3 × 3 = 9, where 3 is an integer.
Constraints