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...
分类:
其他好文 时间:
2014-12-03 13:49:04
阅读次数:
154
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
1
2
3
4
5
6
递归算法
这种问题非常适合用...
分类:
其他好文 时间:
2014-12-02 15:19:59
阅读次数:
168
Wireless Network
Time Limit: 10000MS
Memory Limit: 65536K
Total Submissions: 16885
Accepted: 7091
Description
An earthquake takes place in Southeast Asia. The ACM (...
分类:
Web程序 时间:
2014-12-02 10:38:42
阅读次数:
235
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
1
...
分类:
其他好文 时间:
2014-12-01 22:36:30
阅读次数:
178
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
Follow up:
Did you use extra space?
A straight forward solution using O(mn) space is probably a bad ide...
分类:
其他好文 时间:
2014-11-30 17:00:32
阅读次数:
223
要求:Given a binary tree, flatten it to a linked list in-place.将二叉树转化为平坦序列的树。比如:结题思路:该题有个提示,转化后的树的序列正好是二叉树前序遍历所得到的序列,所以,该题第一个思路就是利用前序遍历的方式来做。第二个思路:我们可以利...
分类:
其他好文 时间:
2014-11-29 18:48:51
阅读次数:
196
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat...
分类:
其他好文 时间:
2014-11-29 10:12:55
阅读次数:
167
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Hide TagsArray 一题严....
分类:
其他好文 时间:
2014-11-28 16:00:34
阅读次数:
128
Meta-Loopless SortsBackgroundSorting holds an important place in computer science. Analyzing and implementing various sorting algorithms forms an impo...
分类:
其他好文 时间:
2014-11-28 09:52:41
阅读次数:
265
WERTYU
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 8492
Accepted: 4063
Description
A common typing error is to place the hands on the keyboard one...
分类:
其他好文 时间:
2014-11-27 22:12:48
阅读次数:
291