Problem Description:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Solution: 递归。 1 public List>...
分类:
其他好文 时间:
2014-07-07 16:59:12
阅读次数:
169
Problem Description:Given a binary tree, return thepostordertraversal of its nodes' valuesSolution: 1 public List postorderTraversal(TreeNode root) { ...
分类:
其他好文 时间:
2014-07-07 16:45:23
阅读次数:
177
树的层次遍历,比较简单,3个题的做法完全一样,只是在特定的地方对结果进行reverse。1、Binary Tree Level Order Traversal/** * Definition for binary tree * struct TreeNode { * int val; * ...
分类:
其他好文 时间:
2014-07-07 16:39:56
阅读次数:
194
Problem Description:Given a binary tree, return thepreordertraversal of its nodes' values.Solution: 1 public List preorderTraversal(TreeNode root)...
分类:
其他好文 时间:
2014-07-07 16:34:34
阅读次数:
208
非常简单的一道题/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x...
分类:
其他好文 时间:
2014-07-07 16:25:49
阅读次数:
220
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
Problem Description:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below bina...
分类:
其他好文 时间:
2014-07-07 15:57:05
阅读次数:
252
Linux下Memcached的安装步骤,如果出现/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory异常在/etc/ld.so.conf中加入/usr/local/lib这一行,保存之后,再运行:/sbin/ldconfig –v更新一下配置即可。...
分类:
系统相关 时间:
2014-06-30 09:20:50
阅读次数:
320
#!/bin/sh
#****************************************************************#
# ScriptName: gccall.sh
# Function: compile *.c in current dir
#***********************************************************...
分类:
其他好文 时间:
2014-06-30 08:05:59
阅读次数:
146
《STL源码剖析》中,指出SGI STL的list底层数据结构式循环双向链表,并且在链表尾端留一个空白节点,让end指向它。由于是双向的,那么list的迭代器必须是Bidirectional Iterator类别的。
下面,分别验证vs2010下和code blocks(gcc)下,list的底层实现是否是循环链表。
#include
#include
using namesp...
分类:
其他好文 时间:
2014-06-30 00:21:54
阅读次数:
202