题目链接题意: 给出 n * n的矩阵,要求将矩阵顺时针旋转90°(不使用额外空间) 1 /* 2
Basically, divide the array into 4 along the diagonals, 3 then for each element
in the top ...
分类:
其他好文 时间:
2014-06-09 15:28:14
阅读次数:
280
Description:Given an array of non-negative
integers, you are initially positioned at the first index of the array.Each
element in the array represents...
分类:
其他好文 时间:
2014-06-09 00:15:33
阅读次数:
193
总算A了,心情好激动……如果会了一类斜率优化,基本上这类题就成了套模版了……只是k函数不同 1
var n,l,x,tail,head,m:int64; 2 i,j:longint; 3 dp,q,s:array[0..100000] of int64;
4 function k(x...
分类:
其他好文 时间:
2014-06-08 21:53:27
阅读次数:
247
这题一看就应该知道是二分图匹配……我记得有个类似的题有一个并查集的解法,但是我找不到了…… 1 var
i,n,m:longint; 2 p:array[0..1500] of longint; 3 v:array[0..1500] of boolean; 4
a:array...
分类:
其他好文 时间:
2014-06-08 21:35:20
阅读次数:
297
原题地址:https://oj.leetcode.com/problems/search-for-a-range/题意:Given
a sorted array of integers, find the starting and ending position of a given
target ...
分类:
编程语言 时间:
2014-06-08 21:03:21
阅读次数:
297
原题地址:https://oj.leetcode.com/problems/sort-colors/题意:Given
an array withnobjects colored red, white or blue, sort them so that objects of
the same col...
分类:
编程语言 时间:
2014-06-08 20:56:32
阅读次数:
394
大水题……不过通过这题我们应该养成一个好习惯:好好看清题……竟然没有看到时限 10sec…… 1
var i,j,n,m,ans:longint; 2 f,time,x,y:array[0..15000] of longint; 3 function
max(x,y:longint):lon...
分类:
其他好文 时间:
2014-06-08 18:38:49
阅读次数:
261
题目
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional el...
分类:
其他好文 时间:
2014-06-08 05:05:47
阅读次数:
268
题目
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 matter what you leave beyond the new length.
原题链接(点我)
解题思路
给一个数组和一个数字,移除该数字在数组中所有出现的地方。
这是一个非常简单的题目,应...
分类:
其他好文 时间:
2014-06-08 04:05:50
阅读次数:
284
题目...For example,Given input array A = [1,1,2],Your function should return length = 2, and A is now [1,2].
解题思路,
移除数组中的重复元素,并返回新数组的长度。
这个题目应该算是简单的题目。使用两个变量就可以。具体的看代码
代码实现......
分类:
其他好文 时间:
2014-06-08 03:54:22
阅读次数:
279