Problem Description:Given a binary tree, return thepreordertraversal of its nodes' values.Solution: 1 public List preorderTraversal(TreeNode root)...
分类:
其他好文 时间:
2014-07-07 16:34:34
阅读次数:
208
好吧,大家认为这样的字体还是比較好看,全部我们就换这样的字体了。INSERT INTO 语句用于向表格中插入新的行。语法INSERT INTO 表名称 VALUES (值1, 值2,....)我们也能够指定所要插入数据的列:INSERT INTO table_name (列1, 列2,...) VA...
分类:
数据库 时间:
2014-07-07 14:56:19
阅读次数:
236
在PHP中,array_count_values() 这个函数可以统计数组元素出现的次数,这个函数会返回一个数组,键名是原数组的值,键值是这个值出现的次数。但是JavaScript中没有这样的函数。不过大神无数,前些日子发现这样的一个扩展:/**javascript 数组扩展实现 php array...
分类:
编程语言 时间:
2014-07-07 13:02:22
阅读次数:
229
$values = array(array(1,2),array(3,4),array(5,6),);$nbValues = count($values);$sql = 'INSERT INTO table_name (col_name1, col_name2) VALUES ';for ($i=0...
分类:
其他好文 时间:
2014-07-01 21:28:51
阅读次数:
226
题目: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,...
分类:
其他好文 时间:
2014-07-01 12:44:09
阅读次数:
199
Gray Code:The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the ...
分类:
其他好文 时间:
2014-07-01 12:42:16
阅读次数:
192
题目:Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For ...
分类:
其他好文 时间:
2014-07-01 12:26:07
阅读次数:
215
本人自己录制的swift菜鸟入门,欢迎大家拍砖,有什么问题可以在这里留言。 主要内容: 函数定义与调用(Defining and Calling Functions) 函数参数与返回值(Function Parameters and Return Values) 函数参数名称(Function Parameter Names) 函数类型(Function Types) 函数嵌套(Nested Fu...
分类:
其他好文 时间:
2014-06-30 16:35:58
阅读次数:
235
【题目】
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorder it to {1,4,2,3}.
【题意】
给定一个链表L: L0→L1→…→Ln-1→Ln,对他重新排序成L...
分类:
其他好文 时间:
2014-06-30 10:11:14
阅读次数:
158
【题目】
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursive solution is trivial, could you do it iteratively?
【题意】
非递归返回先序遍历...
分类:
其他好文 时间:
2014-06-30 06:21:18
阅读次数:
334