Count Primes

Given an integer n, return the number of prime numbers that are strictly less than n.

Constraints

  • 0 <= n <= 5 * 10^6
Saving… · 2 lines
class Solution:
def countPrimes(self, n: int) -> int:
Console

Click Run to execute sample tests.