最近做的题记录下。 258. Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num ...
分类:
其他好文 时间:
2016-11-06 13:54:12
阅读次数:
283
原题: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a ...
分类:
其他好文 时间:
2016-11-05 11:27:28
阅读次数:
202
Sequence Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 9131 Accepted: 3037 Description Given m sequences, each contains n non-negative in ...
分类:
其他好文 时间:
2016-11-04 21:03:14
阅读次数:
274
W3C规范在介绍margin时有这样一句话: Negative values for margin properties are allowed, but there may be implementation-specific limits. 于是,聪明的开发者们就发现了很多负边距的巧妙用法。 比 ...
分类:
其他好文 时间:
2016-11-03 13:49:03
阅读次数:
185
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: ...
分类:
其他好文 时间:
2016-11-02 23:24:56
阅读次数:
185
Problem: Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2. Summary: 以字符串的形式求两个整形数相加。 Analysis: 这道题是 ...
分类:
其他好文 时间:
2016-10-31 09:18:34
阅读次数:
178
首先说一下Reservoir Sampling的原理 ref: http://www.geeksforgeeks.org/reservoir-sampling/ 分析其中的概率: 对于第i个数,它被换入水塘的概率是 k/i,并且在下一次替换中,下一个数被替换进去的概率是 k/i+1,刚好替换到它的概 ...
分类:
其他好文 时间:
2016-10-31 09:07:05
阅读次数:
157
题目: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e ...
分类:
其他好文 时间:
2016-10-30 00:02:52
阅读次数:
184
randomly choose a sample of k items from a list S containing n elements, the algorithm may be online (i.e. the input list is unknown beforehand) https ...
分类:
其他好文 时间:
2016-10-28 02:30:32
阅读次数:
127
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. ...
分类:
移动开发 时间:
2016-10-27 09:56:09
阅读次数:
275