原题地址:http://oj.leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/题意:根据二叉树的先序遍历和中序遍历恢复二叉树。解题思路:可以参照http://www.cnblogs.com...
分类:
编程语言 时间:
2014-05-12 14:24:57
阅读次数:
324
原题地址:http://oj.leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/题意:根据二叉树的中序遍历和后序遍历恢复二叉树。解题思路:看到树首先想到要用递归来解题。以这道题为例:如果一...
分类:
编程语言 时间:
2014-05-12 14:09:28
阅读次数:
321
原题地址:http://oj.leetcode.com/problems/binary-tree-inorder-traversal/题意:二叉树的中序遍历。解题思路:这道题用递归解不难,所以应该考察的是非递归求解二叉树的中序遍历。我们使用一个栈来解决问题。比如一颗二叉树为{1,2,3,4,5,6,...
分类:
编程语言 时间:
2014-05-12 12:48:36
阅读次数:
316
原题地址:http://www.cnblogs.com/x1957/p/3373994.html题意:Given
an array of integers, every element appearstwiceexcept for one. Find that single
one.要求:线性时间复...
分类:
编程语言 时间:
2014-05-10 05:22:27
阅读次数:
408
Jump Game Given an array of non-negative
integers, you are initially positioned at the first index of the array. Each
element in the array represents ...
分类:
其他好文 时间:
2014-05-10 03:13:50
阅读次数:
481
原题地址:http://oj.leetcode.com/problems/single-number-ii/题意:Given
an array of integers, every element appearsthreetimes except for one. Find that
single ...
分类:
编程语言 时间:
2014-05-10 03:01:41
阅读次数:
413
在UEditor一些版本中,如果粘贴Excell中的内容到编辑器,会粘贴不进去,打开控制台发现JS报错了。
在ueditor.all.js:3048行报如下错误:
Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element': The node provided is invalid....
分类:
其他好文 时间:
2014-05-09 15:16:34
阅读次数:
290
递归实现当然太简单,也用不着为了ac走这种捷径吧。。非递归实现还挺有意思的。
树的非递归遍历一定要借助栈,相当于把原来编译器做的事情显式的写出来。对于中序遍历,先要访问最左下的节点,一定是进入循环后,不断的往左下走,走到不能走为止,这时候,可以从栈中弹出访问的节点,相当于“左根右”过程的“根”,然后应该怎么做呢?想一下中序遍历完根节点之后应该干嘛,对,是走到右子树中继续重复这个过程,但是有一点,...
分类:
其他好文 时间:
2014-05-09 14:57:08
阅读次数:
211
戳我去解题Given amxnmatrix, if an element is 0, set its
entire row and column to 0. Do it in
place.这题还是很简单的,就是有点坑,遍历矩阵的时候,每遇到0的时候,我们不能立即将所在行和列置0,否则,到最后矩阵所有...
分类:
其他好文 时间:
2014-05-09 08:51:57
阅读次数:
253
这几个月正式开始运用ExtJS开发项目,接下来会将这几个月的一些经验整理成一个系列博客。今天要讲的是ExtJS中的基础,如何获取component和Dom.element。一、query查询以下的path为查询条件,查询方式类似于JQuery*ComponentQuery返回componentExt.ComponentQuery.query(path)全..
分类:
Web程序 时间:
2014-05-09 00:44:37
阅读次数:
413