medium
Count Primes
Given an integer n, return the number of prime numbers strictly less than n.
Constraints
- 0 ≤ n ≤ 5 · 10^6
Examples
in: n = 10
out: 4
2, 3, 5, 7.
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.