Count Primes Problem
Count Primes Problem — ExecCode Medium DSA Practice
Solve the Count Primes problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given an integer n, return the number of prime numbers that are strictly less than n. Use the Sieve of Eratosthenes. For Count Primes, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.
Examples
Input n = 10; Output 4
Constraints
0 ≤ n ≤ 5·10^6
Practice Count Primes free on ExecCode. Browse DSA problems, topic map, and placement guides.