Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Three Divisors

XPChallenge Points: 10
levelLevel: Easy

Given an integer n, check if it has exactly three positive divisors.
Return true if it does, otherwise return false.

A divisor of n is a number m such that n % m == 0.

Example 1:

Input: n = 6

Output: false

Explanation:

6 has four divisors: 1, 2, 3, and 6.

Example 2:

Input: n = 9

Output: true

Explanation:

9 has exactly three divisors: 1, 3, and 9.

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result