Submissions disabled: This deployment is running in read-only mode for safety. Code execution is not available here.
← Back to all problems
Easy

Prime Check

Updated Jan 31, 2026

Problem

Given an integer n, determine if it is a prime number. Output "YES" if it is prime, "NO" otherwise.

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.

Constraints

1 <= n <= 10^6

Examples

Example 1

Input: n = 7
Output: true

Example 2

Input: n = 4
Output: false

Example 3

Input: n = 1
Output: false

Function Signature

def isPrime(self, n: int) -> bool

How to Submit

Implement a Solution class with a isPrime method.

Your method will be called with the input parameters and should return the answer.