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},
...
分类:
其他好文 时间:
2014-11-27 16:14:23
阅读次数:
184
题目大意:题目背景竟然是dota!屠夫打到大后期就没用了,,只能去吃树!给一个n*m的地图,有些格子是不可到达的,要把所有可到达的格子的树都吃完,并且要走回路,求方案数题解:这题大概是最简单的插头dp了。。比陈丹琦论文里的例题还要简单,因为允许有多个回路,所以不需要存储插头之间的连通性,直接二进制状...
分类:
其他好文 时间:
2014-11-27 15:46:21
阅读次数:
157
【原题】
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
【解析】
题意:根据二叉树先序遍历和中序遍历的结果,构造二叉树。跟 根据中序遍历和后序遍历结...
分类:
其他好文 时间:
2014-11-27 12:50:15
阅读次数:
155
sql中binary_checksum(*)的用法(转)binary_checksum(*)可以用来检查修改过的行。同一行在update后,该行的binary_checksum(*)就不同。 如select title_id,binary_checksum(*) from titles where ...
分类:
数据库 时间:
2014-11-27 12:39:43
阅读次数:
193
【题目】
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
【解析】
题意:根据二叉树中序遍历和后序遍历的结果,构造该二叉树。
首先明确一下,中序遍...
分类:
其他好文 时间:
2014-11-27 10:48:01
阅读次数:
117
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
Recursive Algorithm
class Solution {
public:
bool isSymmetric(TreeNode *root) {
return ...
分类:
其他好文 时间:
2014-11-27 09:18:04
阅读次数:
176
leetcode-Minimum Depth of Binary Tree...
分类:
其他好文 时间:
2014-11-27 09:16:04
阅读次数:
248
Path Sum
Total Accepted: 31405 Total
Submissions: 104326My Submissions
Question
Solution
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that add...
分类:
其他好文 时间:
2014-11-27 09:15:36
阅读次数:
151
4.1Implementafunctiontocheckifatreeisbalanced.Forthepurposesofthisquestion,abalancedtreeisdefinedtobeatreesuchthatnotwoleafnodesdifferindistancefromtherootbymorethanone.Abalancedtree?http://en.wikipedia.org/wiki/Self-balancing_binary_search_treeIteratethetr..
分类:
其他好文 时间:
2014-11-27 08:03:52
阅读次数:
190
题目大意:给你一个数N,输出N的二进制形式上为1的数位(从右至左)
思路:每次(N&1)判断末尾是否为1,为1则存入数组ans[]中,不为1则
不存,之后数位自增,N向右移一位,继续判断末尾……...
分类:
其他好文 时间:
2014-11-27 00:22:28
阅读次数:
288