Given a singly linked listL: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 exam...
分类:
其他好文 时间:
2015-01-08 07:02:39
阅读次数:
168
题目:
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...
分类:
编程语言 时间:
2015-01-07 16:53:03
阅读次数:
200
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-01-07 16:21:35
阅读次数:
143
背景:做了两个多小时,各种出错,各种调试,看了是1993的final题。
学习1.结构体数据类型的定义:
typedef struct{
int x;
int y;
}place;
//使用该类型定义变量。
palce a,b;
2.输入序列一旦被判断为无效的,不应该立即退出,还要处理剩下的该输入序列中的元素,避免被当做下一个输入序列。
3.一旦有变量值可以超出数...
分类:
其他好文 时间:
2015-01-07 09:29:09
阅读次数:
161
Set Matrix Zeroes Total Accepted: 25064 Total Submissions: 80609 My Submissions Question Solution
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
c...
分类:
其他好文 时间:
2015-01-07 09:25:30
阅读次数:
113
题目(Tree DFS)Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The...
分类:
其他好文 时间:
2015-01-06 07:04:43
阅读次数:
210
The problem:Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.My analysis:This is a very typical quesition in m...
分类:
其他好文 时间:
2015-01-06 00:35:28
阅读次数:
288
题目:
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
不使用额外的存储空间,完成N*N的图片的90度旋转(顺时针)
Answer 1: ...
分类:
编程语言 时间:
2015-01-05 16:47:49
阅读次数:
222
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 ....
分类:
其他好文 时间:
2015-01-05 08:16:29
阅读次数:
139
http://codeforces.com/problemset/problem/18/D
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
A customer came t...
分类:
其他好文 时间:
2015-01-04 19:21:42
阅读次数:
217