We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4e4bde commit a9bfdc6Copy full SHA for a9bfdc6
204/main.go
@@ -0,0 +1,13 @@
1
+func countPrimes(n int) int {
2
+ notPrimes := make([]bool, n)
3
+ count := 0
4
+ for i := 2; i < n; i++ {
5
+ if notPrimes[i] == false {
6
+ count++
7
+ for j := 2; i*j < n; j++ {
8
+ notPrimes[i*j] = true
9
+ }
10
11
12
+ return count
13
+}
README.md
@@ -113,6 +113,7 @@
113
- [198 House Robber](./198)
114
- [199 Binary Tree Right Side View](./199)
115
- [200 Number of Islands](./200)
116
+- [204 Count Primes](./204)
117
- [206 Reverse Linked List](./206)
118
- [207 Course Schedule](./207)
119
- [208 Implement Trie (Prefix Tree)](./208)
0 commit comments