class Solution {private: vector nodes;public: void recoverTree(TreeNode *root) { nodes.clear(); dfs(root); // 1 5 3 4 2 6 7...
分类:
其他好文 时间:
2014-08-25 01:07:23
阅读次数:
329
LeetCode: Sum Root to Leaf NumbersGiven a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is t...
分类:
其他好文 时间:
2014-08-24 20:41:33
阅读次数:
175
编写运行于x86实模式下的16位代码是一个很复古的话题,编写能在DOS下运行的Plain Binary可执行文件是一个更复古的话题。以往,凡是需要使用x86的16位实模式的时候,作者都喜欢那NASM来编程。比如《30天自制操作系统》、《Orange's 一个操作系统的实现》、《x86汇编语言——从实...
分类:
系统相关 时间:
2014-08-24 16:35:42
阅读次数:
422
pickle存取图片#Open your images in binary mode and read them in as binary strings then#save them in a list/dict/tuple , then pickle it.>>> import Image, p...
分类:
编程语言 时间:
2014-08-24 15:24:02
阅读次数:
219
1 基于文件指针的数据读写 基于文件指针的数据读写,通常为标准函数,在Windows与Linux下,均可以使用。 数据块读写 NAME fread, fwrite - binary stream input/outputSYNOPSIS #include size_t fread(void *ptr...
分类:
其他好文 时间:
2014-08-23 12:31:00
阅读次数:
203
解题的关键在于这条路径只能是先往上走,到达某个最高点,再往下走,换句话说,只能有一次转折的机会。所以递归这棵树,记录以某个子节点为转折点时的最大值。值得注意的是树节点的值有负值,所以如果某个子路径的和小于0,放弃它(设置和为0)。
class Solution {
public:
int maxPathSum(TreeNode *root) {
int maxSum = -1 <...
分类:
其他好文 时间:
2014-08-23 10:01:00
阅读次数:
167
Description
Problem J
Bits
Input: Standard Input
Output: Standard Output
A bit is a binary digit, taking a logical value of either "1" or "0" (also referred to as "true" or "false" respecti...
分类:
其他好文 时间:
2014-08-22 22:35:36
阅读次数:
278
同上题:但是这题需要考虑好对当前节点的left和right的next指针如何设置。 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLinkNode { 4 * int val; 5 * Tre...
分类:
其他好文 时间:
2014-08-22 22:23:59
阅读次数:
324
由于用到了第三方Html解析类库Hpple,
在导入框架libxml2.2.dylib后,
最到了XCode仍然找不到的情况,
最后解决过程如下:
1、项目-Targets中的Build Phases,
找到Link Binary With Libraries,
点击“+”,添加 “libxml2.dylib”
2、同样的,切换到Buiild Settin...
分类:
移动开发 时间:
2014-08-22 21:10:39
阅读次数:
364