K44
Valid Perfect Square
Problem Statement & Objective
Given a positive integer num, return True if num is a perfect square or False otherwise without using library functions.
Function Signature (Python)
is_perfect_square(num: int) -> boolInput & Output Contract
Output Rule:True veya False.
System Constraints
1 <= num <= 2^31 - 1Example Execution Walkthrough
num = 16 -> 4 * 4 = 16 -> True
num = 14 -> tam karekökü yok -> FalseExample Test Scenarios (3)
Example 1: 16 (4^2)
Input:
[16]Expected Output:
trueExample 2: 14
Input:
[14]Expected Output:
falseExample 3: 1 (1^2)
Input:
[1]Expected Output:
true