Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".SOLUTION:指针指到两个字符串的末尾,不断往前推进,用carr...
分类:
其他好文 时间:
2014-10-26 22:40:47
阅读次数:
339
1、有关html/css, js, php, cgi 的一些认识
当我们浏览器访问一个站点的静态文件,会把文件内容都下载下来(一般压缩),当然如果遇到外联的css/js,会再发起请求得
到。如果我们右键查看网页源代码,一片混乱没法看,可以使用firefox + firebug,可以清晰看到html dom tree,右键inspent
element 可以很快定位到tree...
分类:
Web程序 时间:
2014-10-26 21:24:24
阅读次数:
279
二分查找int binary_search(int a[],int len,int goal){ int beg = 0; int end = len - 1; while(beg goal) end = middle - 1; else ...
分类:
编程语言 时间:
2014-10-26 18:17:20
阅读次数:
145
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2014-10-26 15:33:29
阅读次数:
141
问题描述:
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-10-26 14:24:00
阅读次数:
224
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
分类:
其他好文 时间:
2014-10-26 14:22:44
阅读次数:
183
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-10-26 14:18:14
阅读次数:
251
有了上面的教训,这道题就简单多了,什么时候该更新pre是明白的了,倒是有个细节,二叉搜索树中是不同意有相等节点的,所以题目的要求用黑体字标明了。写的时候注意就能够了。class Solution {public: TreeNode *pre = NULL; bool isValidBST...
分类:
其他好文 时间:
2014-10-26 14:15:49
阅读次数:
229
问题描述:
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...
分类:
其他好文 时间:
2014-10-26 13:11:29
阅读次数:
177
Problem Description
Nowadays, Jim Green has produced a kind of computer called JG. In his computer, the instruction is represented by binary code. However when we code in this computer, we use some m...
分类:
其他好文 时间:
2014-10-26 11:49:22
阅读次数:
357