Best Time to Buy and Sell Stock I II III
分类:
其他好文 时间:
2014-06-29 12:08:25
阅读次数:
275
数组中含有n个数,其中一个数只出现1次,其余个数均出现3次,就只出现1次的数。
首先应该想到的就是计数法,先对数组排序,然后统计每个数出现的次数,找出出现次数为1个数;
更高级一点的方法还是用位运算,充分发掘数字二进制中的0和1出现的规律。一个数字是由0和1组成的,如果这个数字出现3次,那么这个数字中各个位上0和1出现的次数也应该是3次。按照这样统计数组中所有数的各个位1的个数,如果个数是1个倍数,这所求数字该位不为1。
举例如下:
数组: 1, 3, 1, 5, 1, 6, 5, 6, 6, 5
对应的...
分类:
其他好文 时间:
2014-06-20 12:45:44
阅读次数:
185
【题目】
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ 4 8
/ / 11 13 4
...
分类:
其他好文 时间:
2014-06-20 10:53:08
阅读次数:
181
【题目】
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9 20
/ 15 7
return its b...
分类:
其他好文 时间:
2014-06-20 09:42:30
阅读次数:
224
通常情况下的构造函数是不带任何的参数:
class X{
private:
int i;
public:
X() {}
X( int ii):i(ii) {}
};
这其实等效于如下实用参数默认值的形式:
class X{
private:
int i;
public:
X( int ii=0):i(ii) {} //defaul...
分类:
编程语言 时间:
2014-06-07 14:55:06
阅读次数:
250
题目
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum
= 22,
5
...
分类:
其他好文 时间:
2014-06-07 13:47:22
阅读次数:
191
原题地址:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/题意:Say
you have an array for which theithelement is the price of a given stoc...
分类:
编程语言 时间:
2014-06-06 20:04:46
阅读次数:
400
此页面为WP8“三星Galaxy SII”应用的发布页面。“三星Galaxy
SII”是一款收集三星Galaxy S II的玩机技巧的WP8程序,更好的帮助三星Galaxy
SII用户理解并使用它。此页面主要记录开发进度、APP发布等情况。-------------------相关进度-------...
分类:
其他好文 时间:
2014-06-02 16:04:09
阅读次数:
211
利用gdb[i]调试nginx[ii]和利用gdb调试其它程序没有两样,不过nginx可以是daemon程序,也可以以多进程运行,因此利用gdb调试和平常会有些许不一样。当然,我们可以选择将nginx设置为非daemon模式并以单进程运行,而这需做如下设置即可:
daemon off;
master_process off;
这是第一种情况:
这种设置下的nginx在gdb下调试很普通,过...
分类:
数据库 时间:
2014-06-02 04:56:02
阅读次数:
417