189. Count Primes
Medium · Math
Given an integer n, return the count of all prime numbers less than n.
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
Examples
Example 1 Input: n = 10 Output: 4 Explanation: The prime numbers less than 10 are: 2, 3, 5, 7. Count = 4.
Example 2 Input: n = 2 Output: 0 Explanation: There are no prime numbers less than 2.
Constraints
- Standard input/output constraints apply