Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum
= 22,
5
/ \...
分类:
其他好文 时间:
2014-12-01 22:39:17
阅读次数:
186
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.
For example:
Given the below binary tree and sum...
分类:
其他好文 时间:
2014-12-01 22:37:27
阅读次数:
146
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
...
分类:
其他好文 时间:
2014-12-01 22:36:30
阅读次数:
178
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n)
space is pretty straight forward. Could you devis...
分类:
其他好文 时间:
2014-12-01 22:34:27
阅读次数:
309
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2014-12-01 14:13:05
阅读次数:
127
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric...
分类:
其他好文 时间:
2014-12-01 14:11:54
阅读次数:
218
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".思路:逐位相加,进位保留在和的下一位中。C++实现代码:#include#include#in...
分类:
其他好文 时间:
2014-12-01 12:37:36
阅读次数:
146
主从复制技术在MySQL中被广泛使用,主要用于同步一台服务器上的数据至多台从服务器,可以用于实现负载均衡,高可用和故障切换,以及提供备份等等。MySQL支持多种不同的复制技术,诸如单向,半同步异步复制等以及不同级别的复制,诸如数据库级别,表级,跨库同步等等。本文简要描述了一个基本的主从复制并给出示例。 1、复制的基本原理(步骤) a、在主库上把数据更改记录的二进制日志(binary log)...
分类:
数据库 时间:
2014-12-01 10:14:04
阅读次数:
243
题目描述:
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Gi...
分类:
其他好文 时间:
2014-12-01 10:12:10
阅读次数:
207
看图就知道想要做什么事了。Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Given the fo...
分类:
其他好文 时间:
2014-12-01 00:48:40
阅读次数:
166