Flag the Indivisible Token
Intermediate SolvedA sharding scheme prefers bucket counts that have no smaller divisors, so the configuration validator needs to know whether a candidate number is prime.
Implement `solve(Integer n)` to return true if `n` is a prime number (greater than 1 with no divisors other than 1 and itself), false otherwise.
Examples
Input
n = 7Output
trueInput
n = 9Output
falseHints
- Numbers below 2 are not prime.
- Only test divisors up to the square root of n.
Tests
Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.