Practice Three Divisors
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an integer n, return true if n has exactly three positive divisors. Otherwise, return false. An integer m is a divisor of n if there exists an integer k such that n = k * m.
Source: Three Divisors on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 2
Output
false
Explanation
2 has only two divisors: 1 and 2.
# Example 2
Input
n = 4
Output
true
Explanation
4 has three divisors: 1, 2, and 4.
Constraints
1 <= n <= 10^4
Related LeetCode Problems
Practice more problems similar to Three Divisors.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.