Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.最初想法是计算里面能被5整除的数字的个数(因为能被2整除的...
分类:
其他好文 时间:
2015-01-16 16:25:27
阅读次数:
130
为什么Hash函数 H(k) = k % m中 m 尽量不要为2的幂次
下面的截屏来自CLRS的11章 关于哈希函数的讨论
之前我就一直困惑,为什么
When using the division method, we usually avoid certain values of m. For example, m should...
分类:
其他好文 时间:
2015-01-16 13:06:56
阅读次数:
196
3.1 依赖倒置原则的定义 依赖倒置原则(Dependence Inversion Principle,简称DIP)这个名字看着有点别扭,“依赖”还“倒置”,这到底是什么意思?依赖倒置原则的原始定义是:High level modules should not depend upon low lev...
分类:
其他好文 时间:
2015-01-16 11:17:55
阅读次数:
309
Given an unsorted integer array, find the first missing positive integer.
For example,
Given [1,2,0] return 3,
and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses constant...
分类:
其他好文 时间:
2015-01-16 10:05:38
阅读次数:
136
题目:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two...
分类:
其他好文 时间:
2015-01-15 21:35:19
阅读次数:
115
Factorial Trailing ZeroesGiven an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.思路:不...
分类:
其他好文 时间:
2015-01-15 15:57:13
阅读次数:
158
【题目】
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the t...
分类:
其他好文 时间:
2015-01-15 12:57:02
阅读次数:
174
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using ext...
分类:
其他好文 时间:
2015-01-15 11:05:40
阅读次数:
207
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without usi...
分类:
其他好文 时间:
2015-01-15 11:03:15
阅读次数:
157
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using ext...
分类:
其他好文 时间:
2015-01-14 23:01:20
阅读次数:
402