Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use constant ...
分类:
其他好文 时间:
2015-01-04 13:37:37
阅读次数:
139
为了使用ActionBar实现Tab导航,按如下步骤进行即可。1.调用ActionBar的setNavigationMode(ActionBar.NAVIGATION_MODE_TABS)方法设置使用Tab导航方式。2.调用ActionBar的addTab方法添加多个Tab标签,并为每个Tab标签添...
分类:
其他好文 时间:
2015-01-04 06:25:01
阅读次数:
6464
公司和学校事情比较多,隔了好几天没刷题,今天继续刷起来。题目:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve i...
分类:
编程语言 时间:
2015-01-03 17:11:53
阅读次数:
193
用TexStudio编辑文档时,不知是多加了空格还是啥,总是提示如下错误:Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.删除掉一些内容(code)之后可以成功编译,不过添加(code)之后,又反复出现....
分类:
其他好文 时间:
2015-01-03 11:49:03
阅读次数:
947
Two Sum II - Input array is sortedGiven an array of integers that is alreadysorted in ascending order, find two numbers such that they add up to a spe...
分类:
其他好文 时间:
2015-01-02 23:39:25
阅读次数:
229
单词:never 从不early 早的sometiomes 有时until 直到 pr.out of … …的外面dark 黑暗/的 n. adj.outside 外面 adv.thought 想 think的过去式短语/句子:get up early 早起on sundays 每个星期天stay ...
分类:
其他好文 时间:
2015-01-02 23:36:13
阅读次数:
258
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil...
分类:
其他好文 时间:
2015-01-02 18:45:09
阅读次数:
149
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2015-01-02 15:50:42
阅读次数:
124
题意:可以理解为给你一个图,让你建一个树,然后从某根开始走,每走一条边就要消耗两边点权+边的边权。最后再加上一个根的点权,问最少花多少代价。
题解:改变边权然后做最小生成树。
#include
#include
#include
#include
#include
#define N 101000
#define inf 0x3f3f3f3f
using namespace std;...
分类:
其他好文 时间:
2015-01-02 14:44:44
阅读次数:
158
题解:
首先考虑dfs,但是看到答案的“64bit”就放弃了吧、
所以肯定是组合数、状压DP什么的,尤其是那个16,标准的状压数。
好吧,就是状压DP。
f[i][j]表示i是状压的01串表示哪个取了哪个没取,然后j是结尾字符,
虽然水,但是时间复杂度是可以过的。
代码:
#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2015-01-02 12:17:27
阅读次数:
148