Problem Description:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf ...
分类:
其他好文 时间:
2014-07-07 16:01:34
阅读次数:
223
C/C++如何产生随机数:这里要用到的是rand()函数, srand()函数,C语言/C++里没有自带的random(int number)函数。(1) 假设你仅仅要产生随机数而不须要设定范围的话,你仅仅要用rand()就能够了:rand()会返回一随机数值, 范围在0至RAND_MAX 间。RA...
分类:
编程语言 时间:
2014-07-07 15:25:20
阅读次数:
210
ECMAScript规范中使用IEEE754格式来表示整数和浮点数。支持十进制、八进制以及十六进制。有一点注意的是八进制数字在严格模式下是无效的,这可能会影响到程序的正常运行。 避免浮点数等值判断: 众所周知,基于IEEE754进行数据计算会产生舍入误差,最为经典的例子: 0.1+0.2 = 0.3...
分类:
编程语言 时间:
2014-07-07 13:01:37
阅读次数:
192
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 is at...
分类:
其他好文 时间:
2014-07-03 11:53:07
阅读次数:
182
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...
分类:
其他好文 时间:
2014-07-01 00:23:01
阅读次数:
248
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 nu...
分类:
其他好文 时间:
2014-06-30 21:36:50
阅读次数:
292
题目
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 witho...
分类:
其他好文 时间:
2014-06-30 19:38:37
阅读次数:
226
题目
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...
分类:
其他好文 时间:
2014-06-30 19:23:18
阅读次数:
200
题目
Given n points
on a 2D plane, find the maximum number of points that lie on the same straight line.
方法
每次选择一个点,和其他n - 1个点,进行判断,统计最多的。
double computeSlope(Point a, Point b) {
...
分类:
其他好文 时间:
2014-06-30 15:48:45
阅读次数:
184