diff --git a/C++/204 Count Primes.cpp b/C++/204 Count Primes.cpp new file mode 100644 index 0000000..041cfed --- /dev/null +++ b/C++/204 Count Primes.cpp @@ -0,0 +1,21 @@ +class Solution { +public: + int countPrimes(int n) { + int count=0; + if(n<=1) return 0; + + vector prime(n,true); + prime[1]=false; + for(int i=2;i