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?抠细节的题,题目思想如下:to...
分类:
其他好文 时间:
2014-06-28 22:11:37
阅读次数:
214
Reorder ListGiven 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' val...
分类:
其他好文 时间:
2014-06-28 20:42:16
阅读次数:
265
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-06-21 07:17:47
阅读次数:
210
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for...
分类:
其他好文 时间:
2014-06-20 21:48:33
阅读次数:
254
The diesel engine crusher is mainly used in some place that don‘t have enough electricity or without electricity. They can do the middle or fine crush...
分类:
其他好文 时间:
2014-06-20 19:19:33
阅读次数:
248
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?public class Soluti...
分类:
其他好文 时间:
2014-06-18 21:54:54
阅读次数:
232
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Could you devise a constant space solution?
思路:因为需要遍历整个矩阵,时间复杂度肯定需要O(m * n),对于空间复杂度而言,第一种是可以使用O(m * n),...
分类:
其他好文 时间:
2014-06-18 12:33:39
阅读次数:
167
// Playground - noun: a place where people can playimport Cocoavar nums = Int[]()for _ in 1...50{ nums.append(random())}nums////冒泡排序/*var count = 0...
分类:
移动开发 时间:
2014-06-18 09:57:23
阅读次数:
303
题目链接 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...
分类:
其他好文 时间:
2014-06-17 23:45:10
阅读次数:
373
1、
??
Reverse Linked List II
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->5->NULL....
分类:
其他好文 时间:
2014-06-17 23:03:12
阅读次数:
257