Given an integer n, return the number of prime numbers that are strictly less than n.
A prime number is a number greater than 1 that is divisible only by 1 and itself.
Your task is to count all such prime numbers that are smaller than the given number n.
Input: n = 5
Output: 6
Explanation:
Prime numbers less than 5 are [2, 3].
Input: n = 20
Output: 8
Explanation:
Prime numbers less than 20 are [2, 3, 5, 7, 11, 13, 17, 19]. Hence, the count is 8.
Input: n = 15
Output: 2
Explanation:
Prime numbers less than 15 are [2, 3, 5, 7, 11, 13].
Accepted:
Submission: