Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s...
分类:
其他好文 时间:
2015-02-09 15:40:55
阅读次数:
176
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...
分类:
其他好文 时间:
2015-02-09 14:03:34
阅读次数:
132
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 idea.A si...
分类:
其他好文 时间:
2015-02-09 12:53:24
阅读次数:
217
标题:Set Matrix Zeroes通过率:31.3%难度:中等Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Fol...
分类:
其他好文 时间:
2015-02-09 12:43:33
阅读次数:
108
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...
分类:
其他好文 时间:
2015-02-09 09:23:32
阅读次数:
176
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...
分类:
其他好文 时间:
2015-02-08 15:26:43
阅读次数:
145
题目要求:Rotate ImageYou are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?代码...
分类:
其他好文 时间:
2015-02-07 21:32:30
阅读次数:
204
题目描述:Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new ...
分类:
其他好文 时间:
2015-02-07 17:18:43
阅读次数:
140
题目要求:Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be chan...
分类:
其他好文 时间:
2015-02-07 17:11:25
阅读次数:
146
原理通过构建有序序列,对于未排序数据,在已排序序列中从后向前扫描,找到相应位置并插入。通常采用in-place排序(即只需用到O(1)的额外空间的排序),因而在从后向前扫描过程中,需要反复把已排序元素逐步向后挪位,为最新元素提供插入空间。相信大家都打过扑克牌,很好理解。例子将数组[5,6,3,1,8...
分类:
编程语言 时间:
2015-02-06 18:24:45
阅读次数:
108