Count Primes
Description:
Count the number of prime numbers less than a non-negative number, n.
题目 Count Primes
计算小于n的所有素数的总数。
用一般的方法超时,应该用筛选法求素数 ,参考 筛选法求素数
class Solution {
publ...
分类:
其他好文 时间:
2015-07-26 21:01:15
阅读次数:
164
LeetCode 2_Add Two Numbers
题目描述:
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Ad...
分类:
其他好文 时间:
2015-07-26 06:14:59
阅读次数:
131
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of ...
分类:
其他好文 时间:
2015-07-25 10:45:07
阅读次数:
114
You are not given n non-negative
integers X0, X1,..., Xn-1 less
than 220, but they do exist, and their values never change.
I'll gradually provide you some facts about them, and ask you some ques...
分类:
其他好文 时间:
2015-07-24 20:49:36
阅读次数:
206
Description:
Count the number of prime numbers less than a non-negative number, n.
判断一个数是否是质数主要有以下几种方法:
1)直接用该数除于所有小于它的数(非0,1),如果均不能被它整除,则其是质数;
2)除以小于它一半的数,因为大于其一半必定是无法整除,如果均不能被它整除,则其是质数;
...
分类:
其他好文 时间:
2015-07-24 10:45:19
阅读次数:
99
问题描述Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit i...
分类:
其他好文 时间:
2015-07-24 09:14:22
阅读次数:
120
Problem Definition:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most sign...
分类:
其他好文 时间:
2015-07-23 23:19:21
阅读次数:
130
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6...
分类:
其他好文 时间:
2015-07-23 13:38:27
阅读次数:
102
2. Add Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes...
分类:
其他好文 时间:
2015-07-22 22:40:11
阅读次数:
119
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
Above is a histogram where width o...
分类:
其他好文 时间:
2015-07-22 14:40:08
阅读次数:
95