Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-12-11 20:49:19
阅读次数:
177
标题:Same Tree通过率:42%难度简单Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are st...
分类:
其他好文 时间:
2014-12-11 20:48:26
阅读次数:
164
Path Sum IIGiven 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 tr...
分类:
其他好文 时间:
2014-12-11 20:36:17
阅读次数:
205
判定一棵二叉树是不是二叉平衡树。链接:https://oj.leetcode.com/problems/balanced-binary-tree/题目描述:Given a binary tree, determine if it is height-balanced.For this problem...
分类:
其他好文 时间:
2014-12-11 18:56:57
阅读次数:
162
思路:把数字排序,排序后数字列,中间点为父节点,左边部分为左子树,右边为右子树。
假设节点定义为:
// Definition for binary tree
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), ...
分类:
其他好文 时间:
2014-12-11 12:31:45
阅读次数:
126
原文链接 http://blog.csdn.net/yaochunnian/article/details/7261006grep 文件报错 “Binary file ... matches” 原因:文件为binary文件解决:strings vers.log.2010-03-09 | grep ....
分类:
其他好文 时间:
2014-12-10 22:48:31
阅读次数:
178
Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l...
分类:
其他好文 时间:
2014-12-10 22:42:43
阅读次数:
166
【题目】
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...
分类:
其他好文 时间:
2014-12-10 12:35:23
阅读次数:
191
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".先进行对齐操作,然后从右往左逐位相加,注意进位即可。代码写的比较长,但是很...
分类:
其他好文 时间:
2014-12-10 12:20:23
阅读次数:
196
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 binary tree, 1 ...
分类:
其他好文 时间:
2014-12-09 23:00:59
阅读次数:
276