码迷,mamicode.com
首页 >  
搜索关键字:rotate array    ( 30802个结果
Leetcode::Longest Common Prefix && Search for a Range
一次总结两道题,两道题目都比较基础Description:Write a function to find the longest common prefix string amongst an array of strings.分析: 这道题目最重要的知道什么叫prefix前缀, 否则一不小心就做...
分类:其他好文   时间:2014-06-09 21:08:16    阅读次数:224
Codeforces Round #251 (Div. 2) C. Devu and Partitioning of the Array
注意p的边界情况,p为0,或者 p为k奇数+偶数 = 奇数奇数+奇数 = 偶数#include #include #include #include #include using namespace std;int main(){ int n,k,p; long a; cin >>...
分类:其他好文   时间:2014-06-09 20:20:23    阅读次数:243
输出超过一半的数
//输出超过一半的数,如果没有则输出-1。通过编译,bymyselfimport java.util.*;public class MoreThanHalf{ public static void main(String args[]){ int array[]={3,4,5,3...
分类:其他好文   时间:2014-06-09 19:32:47    阅读次数:254
[leetcode]Search in Rotated Sorted Array @ Python
原题地址:https://oj.leetcode.com/problems/search-in-rotated-sorted-array/题意:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e...
分类:编程语言   时间:2014-06-09 18:43:14    阅读次数:273
[leetcode]First Missing Positive @ Python
原题地址:https://oj.leetcode.com/problems/first-missing-positive/题意:Given an unsorted integer array, find the first missing positive integer.For example,G...
分类:编程语言   时间:2014-06-09 17:44:43    阅读次数:980
LeetCode --- Rotate Image
题目链接题意: 给出 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 - Single Number
今天开始刷leetcode上的题,争取校招前刷过一遍,从AC率最高的题目开始刷,不废话了,看题题目:Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single ...
分类:其他好文   时间:2014-06-09 12:57:45    阅读次数:260
[HNOI2006]超级英雄Hero
这题一看就应该知道是二分图匹配……我记得有个类似的题有一个并查集的解法,但是我找不到了…… 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
[leetcode]Search for a Range @ Python
原题地址: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
[leetcode]Sort Colors @ Python
原题地址: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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!