For example:
Given the below binary tree and sum
= 22,
5
/ 4 8
/ / 11 13 4
/ \ / 7 2 5 1
re...
分类:
其他好文 时间:
2015-05-11 09:08:25
阅读次数:
120
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
1
...
分类:
其他好文 时间:
2015-05-11 09:03:58
阅读次数:
107
题目描述
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next righ...
分类:
其他好文 时间:
2015-05-11 09:03:22
阅读次数:
100
题目来自于LeetCode
https://leetcode.com/problems/binary-tree-maximum-path-sum/
Binary Tree Maximum Path Sum
Total Accepted: 37936 Total
Submissions: 178064My Submissions
Question
Solutio...
分类:
其他好文 时间:
2015-05-11 00:05:34
阅读次数:
125
mysql查询默认不区分大小写,这在用户登录验证等情况下明显行不通。不过可以加一个关键字,binary,用二进制查询的方式。而在thinkphp中没有这个查询条件,只好用原生sql查询实现。publicfunction loginCheck(){ $username = I('para...
分类:
Web程序 时间:
2015-05-10 23:48:32
阅读次数:
183
DescriptionConsider all the sequences with length (0#include#includeusing namespace std;int dp[45][2];int main(){ int n,k; dp[1][0] = dp[1][1]= ...
分类:
其他好文 时间:
2015-05-10 22:00:04
阅读次数:
164
Description
Zuosige always has bad luck. Recently, he is in hospital because of pneumonia. While he is taking his injection, he feels extremely bored. However, clever Zuosige comes up with a new ga...
分类:
其他好文 时间:
2015-05-10 20:35:16
阅读次数:
150
Title:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST'...
分类:
其他好文 时间:
2015-05-10 20:14:33
阅读次数:
126
题目传送门 1 /* 2 dp[i][1]/dp[i][0] 表示从左往右前i个,当前第i个放1或0的方案数 3 k -= dp[n][0] 表示当前放0的方案数不够了,所以必须放1,那么dp[n][0]个方案数都不能用了 4 相当于k减去这么多 5 详细解释:htt...
分类:
其他好文 时间:
2015-05-10 18:55:07
阅读次数:
120
树状数组(Binary Indexed Tree(BIT), Fenwick Tree)是一个查询和修改复杂度都为log(n)的数据结构。主要用于查询任意两位之间的所有元素之和,但是每次只能修改一个元素的值;经过简单修改可以在log(n)的复杂度下进行范围修改,但是这时只能查询其中一个元素的值。树状...
分类:
编程语言 时间:
2015-05-10 18:47:59
阅读次数:
181