You are given the ages (in years) of all people of a country with at least 1 year of age. You know thatno individual in that country lives for 100 or ...
分类:
其他好文 时间:
2015-07-17 11:40:23
阅读次数:
102
I had a couple of interviews long ago which asked me to implemented a?least recently used (LRU)?cache. A cache itself can simply be implemented using a hash table, however adding a size limit giv...
分类:
编程语言 时间:
2015-07-16 07:23:26
阅读次数:
178
实现代码如下: import?java.util.LinkedHashMap;
import?java.util.Map;
/**
?*?LRU?(Least?Recently?Used)?算法的Java实现
?*?@param?<K>
?*?@param?<V>
?*?@author?杨尚川
?*/
public?cla...
分类:
编程语言 时间:
2015-07-15 23:16:39
阅读次数:
275
基数排序(Radix sort)是一种非比较型的整数排序算法,其原理是将整数按位数切割成不同的数字,然后按每个位数分别比较。基数排序也分为LSD(Least significant digital)和MSD(Most significant digital)两种方式,LSD的排序方式由键值的最右边开...
分类:
编程语言 时间:
2015-07-15 18:30:39
阅读次数:
212
这个看起来很弱爆的问题其实是因为其他的配置文件中已经出现了为xx定义好的注入.如果用@Autowired就会得到上面的错误 , 但是用@Resource的时候就会看到类似下面的错误Bean named 'moneyRecordDao' must be of type [com.fuscent.cor...
分类:
其他好文 时间:
2015-07-14 13:11:13
阅读次数:
188
题意:求n个数的最小公倍数
分析:用方法:lcm(a,b,c)=lcm(a,lcm(b,c))。注意先除后乘防止整数溢出(小技巧)
代码:
#include
using namespace std;
int t,n,a;
int gcd(int a,int b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
cin>>t;
while(t--){...
分类:
其他好文 时间:
2015-07-14 06:14:22
阅读次数:
145
题目:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],...
分类:
其他好文 时间:
2015-07-13 22:22:20
阅读次数:
95
题目:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2...
分类:
其他好文 时间:
2015-07-13 22:02:02
阅读次数:
142
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2015-07-12 22:53:56
阅读次数:
146
给出一个矩阵,求从左上角到右下角找出一条路径,使得这条路径上的所有数的乘积后缀0最小。从左上角至右下角的输出路径。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using names...
分类:
其他好文 时间:
2015-07-10 20:47:40
阅读次数:
142