[Leetcode] 204. Count Primes

  1. Count Primes

Description:
Count the number of prime numbers less than a non-negative number, n.
Credits:Special thanks to @mithmatt for adding this problem and creating all test cases.

public class Solution {
    public int countPrimes(int n) {
        int sum=0;
        boolean c[] = new boolean[n];
        for (int i=2;i*i

你可能感兴趣的:([Leetcode] 204. Count Primes)