题目:Given a tree, you are supposed to list all the leaves in the order of top down, and left to right.Input Specification:Each input file contains one ...
分类:
其他好文 时间:
2015-04-05 20:12:55
阅读次数:
168
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2015-04-05 18:53:07
阅读次数:
110
A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with...
分类:
其他好文 时间:
2015-04-05 14:40:31
阅读次数:
171
题目:
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9...
分类:
其他好文 时间:
2015-04-05 12:00:39
阅读次数:
145
题目:
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf
to root).
For example:
Given binary tree {3,9,20,...
分类:
其他好文 时间:
2015-04-05 11:58:39
阅读次数:
111
网上说法很多。。这里简单描述一下。
一群人围成一个圈,每个人都有自己的密钥。。出列后用其密钥做下一个循环出队数。
源代码
#include
#include
typedef struct _node{
int ord;//order
int key;//key
struct _node* next;
}Node,*pNode;
pNode Create(){
int k,o=1;
...
分类:
其他好文 时间:
2015-04-04 22:37:45
阅读次数:
166
题目:
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it ...
分类:
其他好文 时间:
2015-04-04 21:16:34
阅读次数:
139
二叉树的层序遍历思路一:利用队列,将每一层节点放入队列,各层节点之间加入NULL隔开。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 ...
分类:
其他好文 时间:
2015-04-04 19:44:40
阅读次数:
110
Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, ...
分类:
其他好文 时间:
2015-04-04 18:29:57
阅读次数:
133
Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST....
分类:
其他好文 时间:
2015-04-04 15:01:48
阅读次数:
117