Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: ...
分类:
其他好文 时间:
2016-04-21 10:04:59
阅读次数:
91
Problem Description
When shopping on Long Street, Michael usually parks his car at some random location, and then walks to the stores he needs.
Can you help Michael choose a place to park which minim...
分类:
其他好文 时间:
2016-04-20 02:04:18
阅读次数:
163
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2- ...
分类:
其他好文 时间:
2016-04-18 18:39:21
阅读次数:
176
17.1 Write a function to swap a number in place (that is, without temporary variables). 这道题让我们交换两个数,但是不能用额外空间,那么我们可以先做差值,存入a中,然后再加上b,存入b中,那么此时的b即为原来的a ...
分类:
其他好文 时间:
2016-04-18 06:24:17
阅读次数:
119
We would like to place n rooks, 1 n 5000, on a n nboard subject to the following restrictions? The i-th rook can only be placed within the recta ...
分类:
其他好文 时间:
2016-04-17 17:40:08
阅读次数:
213
http://blog.csdn.net/xiazdong/article/details/8462393 In-place sort(不占用额外内存或占用常数的内存):插入排序、选择排序、冒泡排序、堆排序、快速排序。 Out-place sort:归并排序、计数排序、基数排序、桶排序。 stabl ...
分类:
编程语言 时间:
2016-04-16 18:19:03
阅读次数:
281
Link: https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Given a sorted array, remove the duplicates in place such that each element a ...
分类:
其他好文 时间:
2016-04-15 20:20:05
阅读次数:
164
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? 思路:把矩阵看成是由多个 ...
分类:
其他好文 时间:
2016-04-12 00:03:53
阅读次数:
215
Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you ...
分类:
其他好文 时间:
2016-04-11 20:48:21
阅读次数:
133
Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you ...
分类:
其他好文 时间:
2016-04-10 00:55:19
阅读次数:
224