leetcode | Count Primes
来源:互联网 发布:手机淘宝一键秒杀神器 编辑:程序博客网 时间:2024/06/06 06:50
Description:
Count the number of prime numbers less than a non-negative number, n.
找出小于n的质数的个数
public class Solution { public int countPrimes(int n) { if(n<=2) return 0; boolean[] a = new boolean[n]; int count=0; for(int i=2;i<n;i++) { if(!a[i]) { count++; for(int j=i;j<n;j+=i) { a[j]=true; } } } return count; }}
0 0
- LeetCode 204 - Count Primes
- [LeetCode] Count Primes
- LeetCode #Count Primes#
- 【leetcode】Count Primes
- LeetCode 204-Count Primes
- [LeetCode] Count Primes
- [LeetCode 204] Count Primes
- [LeetCode]Count Primes
- leetcode 204: Count Primes
- Count Primes Leetcode JAVA
- LeetCode OJ Count Primes
- [leetcode]Count Primes
- leetcode--Count Primes
- [LeetCode]Count Primes
- Count Primes LeetCode
- LeetCode (36) Count Primes
- LeetCode 204:Count Primes
- LeetCode:Count Primes
- ffmpeg处理RTMP流媒体的命令大全
- 图像的编辑和处理
- ArrayList LinkedList Vector 区别
- Gson和Fastjson的使用
- ESXi thin磁盘空间回收
- leetcode | Count Primes
- 写让别人能读懂的代码
- Python – How to delay few seconds
- memcache的线程模型
- MVP实现的步骤梳理
- android显示一个通知
- iOS之循环引用
- 黑马程序员—C语言指针的了解和使用
- Android使用UncaughtExceptionHandler捕获全局异常