描述Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as a substring of B? For ...
分类:
其他好文 时间:
2014-11-13 20:39:39
阅读次数:
139
题目地址:1156. Binary tree思路: 如何愉快地前序输出呢,要在存储数据的时候根据位置来存放数据! 一开始被自己蠢哭,一直以为第一个输入的就是根结点(例子的祸害呀啊啊啊!!!!),结果证明不是的,所以呢,我们要找出根结点,那么怎么找根结点呢,我用了一个向量来存储下标值,遍历向量值...
分类:
其他好文 时间:
2014-11-13 20:30:20
阅读次数:
135
1 function toTreeData(data){ 2 var pos={}; 3 var tree=[]; 4 var i=0; 5 while(data.length!=0){ 6 if(da...
分类:
编程语言 时间:
2014-11-13 14:28:27
阅读次数:
222
这个题目纠结了一会儿,终于从二叉树转化到AVL了。题目如下:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a ...
分类:
其他好文 时间:
2014-11-13 12:41:02
阅读次数:
157
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 andsum =...
分类:
其他好文 时间:
2014-11-13 00:16:31
阅读次数:
247
Description约翰意识到贝茜建设网络花费了他巨额的经费,就把她解雇了.贝茜很愤怒,打算狠狠报复.她打算破坏刚建成的约翰的网络.约翰的网络是树形的,连接着N(1≤N≤10000)个牛棚.她打算切断某一个牛棚的电源,使和这个牛棚相连的所有电缆全部中断.之后,就会存在若干子网络.为保证破坏够大,每...
分类:
其他好文 时间:
2014-11-12 22:42:52
阅读次数:
251
阈值操作类型这5种阈值操作类型保留opencv tutorials中的英文名称,依次为:Threshold Binary:即二值化,将大于阈值的灰度值设为最大灰度值,小于阈值的值设为0。Threshold Binary, Inverted:将大于阈值的灰度值设为0,大于阈值的值设为最大灰度值。Truncate:将大于阈值的灰度值设为阈值,小于阈值的值保持不变。Threshold to Zero:将...
分类:
其他好文 时间:
2014-11-12 17:50:05
阅读次数:
214
/**
* Definition for binary tree
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
publi...
分类:
其他好文 时间:
2014-11-12 13:49:37
阅读次数:
169
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
/ 2 3
Return 6....
分类:
其他好文 时间:
2014-11-12 13:47:59
阅读次数:
139
题目来源:http://poj.org/problem?id=2255
Tree Recovery
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 11649
Accepted: 7311
Description
Little Valent...
分类:
其他好文 时间:
2014-11-12 13:46:37
阅读次数:
153