原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal/题意:二叉树的层序遍历的实现。解题思路:二叉树的层序遍历可以用bfs或者dfs来实现。这里使用的dfs实现,代码比较简洁。实际上,二叉树的先序遍历就是dfs实...
分类:
编程语言 时间:
2014-05-14 03:25:59
阅读次数:
428
Integers1, 2, 3,...,nare placed on a circle in
the increasing order as in the following figure. We want to construct a sequence
from these numbers on ...
分类:
其他好文 时间:
2014-05-14 02:54:10
阅读次数:
354
Pat1018代码
题目描述:
There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to an...
分类:
其他好文 时间:
2014-05-13 23:27:04
阅读次数:
582
Pat1016代码
题目描述:
A long-distance telephone company charges its customers by the following rules:
Making a long-distance call costs a certain amount per minute, depending on the time of day w...
分类:
其他好文 时间:
2014-05-13 06:45:05
阅读次数:
460
今天碰到个很怪异的问题,如题关于mysql的ORDERBY语句和Limitoffset语句问题。bug再现下:select*fromAawherea.culomn1limit5offset0orderbya.culomn1asc则出现sqlException,提示orderby这行有问题。若将语句改为如下,将limit语句和orderby语句调换:select*fromAawherea.cul..
分类:
数据库 时间:
2014-05-13 01:14:39
阅读次数:
344
原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/题意:Given
a binary tree, return thebottom-up level ordertraversal of its node...
分类:
编程语言 时间:
2014-05-12 22:03:27
阅读次数:
581
原题地址:http://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/题意:Given
a binary tree, return thezigzag level ordertraversal of its nod...
分类:
编程语言 时间:
2014-05-12 22:02:26
阅读次数:
480
Spiral MatrixGiven a matrix ofmxnelements
(mrows,ncolumns), return all elements of the matrix in spiral order.For
example,Given the following matrix:[...
分类:
其他好文 时间:
2014-05-12 20:04:43
阅读次数:
268
Given an integern, generate a square matrix
filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should
return the following matri...
分类:
其他好文 时间:
2014-05-12 19:53:23
阅读次数:
332
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=151
For each list of words, output a line with each word reversed without changing the order of the words.
This problem contains multi...
分类:
其他好文 时间:
2014-05-11 22:20:43
阅读次数:
443