sieve-of-eratosthenes1 LeetCode. Count Primes [Math] Problem: Count the number of prime numbers less than a non-negative number, n. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7. -Summary- Used Sieve of Eratosthenes 1. List all the numbers start from the 2. 2. 2 is a Prime number. 3. Remove all the number that is multiple of 2. 4. The smallest number that is not removed, is a 3 which is a pri.. 2020. 6. 14. 이전 1 다음