一次总结两道题,两道题目都比较基础Description:Write a function to
find the longest common prefix string amongst an array of strings.分析:
这道题目最重要的知道什么叫prefix前缀, 否则一不小心就做...
分类:
其他好文 时间:
2014-06-09 21:08:16
阅读次数:
224
题目链接题意: 给出 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
今天开始刷leetcode上的题,争取校招前刷过一遍,从AC率最高的题目开始刷,不废话了,看题题目:Single
NumberGiven an array of integers, every element appearstwiceexcept for one. Find
that single ...
分类:
其他好文 时间:
2014-06-09 12:57:45
阅读次数:
260
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