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-07-22 22:53:14
阅读次数:
184
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?...
分类:
编程语言 时间:
2014-07-19 23:46:49
阅读次数:
516
Consider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmetical expr...
分类:
其他好文 时间:
2014-07-19 22:37:50
阅读次数:
243
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:
其他好文 时间:
2014-07-19 22:19:36
阅读次数:
202
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-07-19 11:47:54
阅读次数:
168
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-07-19 00:24:36
阅读次数:
170
写这个就是为了手写一份好用的求割点模板:
吐槽下,题目中的 Each of the next at most N lines contains the number of a place followed by the numbers of some places to which there is a direct line from this place. 这个at most是不可信的,应...
分类:
其他好文 时间:
2014-07-18 11:29:34
阅读次数:
232
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:
其他好文 时间:
2014-07-18 00:32:24
阅读次数:
271
Set Matrix ZeroesGiven amxnmatrix, 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...
分类:
其他好文 时间:
2014-07-17 23:34:02
阅读次数:
486
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-07-17 00:23:27
阅读次数:
215