码迷,mamicode.com
首页 >  
搜索关键字:median of two sorted    ( 17004个结果
[BestCoder Round #3] hdu 4908 BestCoder Sequence (计数)
BestCoder Sequence Problem Description Mr Potato is a coder. Mr Potato is the BestCoder. One night, an amazing sequence appeared in his dream. Length of this sequence is odd, the median...
分类:其他好文   时间:2014-08-04 17:42:57    阅读次数:282
Multiply Strings leetcode java
题目:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-....
分类:编程语言   时间:2014-08-04 13:58:57    阅读次数:285
N-Queens leetcode
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc...
分类:其他好文   时间:2014-08-04 13:31:07    阅读次数:250
URAL 1306 Sequence Median(优先队列)
题意:求一串数字里的中位数。内存为1M。每个数范围是0到2的31次方-1。思路:很容易想到把数字全部读入,然后排序,但是会超内存。用计数排序但是数又太大。由于我们只需要第n/2、n/2+1大(n为偶数)或第(n+1)/2大(n为奇数)。所以可以用优先队列来维护最值,这样只需要存一半元素(n/2+1个...
分类:其他好文   时间:2014-08-04 13:29:27    阅读次数:215
Remove Duplicates from Sorted Array II leetcode java
题目:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function shou....
分类:编程语言   时间:2014-08-04 13:24:27    阅读次数:256
Add Binary Leetcode java
题目:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".题解:二进制加法都是从最低位(从右加到左)。所以对两个字符串要从最后一位开始加,....
分类:编程语言   时间:2014-08-04 06:13:36    阅读次数:291
Gray Code leetcode java
题目:The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total ....
分类:编程语言   时间:2014-08-04 04:10:46    阅读次数:309
ZOJ 3048 (HDU 2258) Continuous Same Game (1)
Problem Description Continuous Same Game is a simple game played on a grid of colored blocks. Groups of two or more connected (orthogonally, not diagonally) blocks that are the same color may be r...
分类:其他好文   时间:2014-08-03 23:21:29    阅读次数:336
POJ - 1436 Horizontally Visible Segments
Description There is a number of disjoint vertical line segments in the plane. We say that two segments are horizontally visible if they can be connected by a horizontal line segment that does not ...
分类:其他好文   时间:2014-08-03 23:16:26    阅读次数:412
Remove Duplicates from Sorted Array
问题:将有序的数组中重复的数字去掉分析:由于有序所以只用和前一个比较就行class Solution {public: int removeDuplicates(int A[], int n) { int i,j; if(n==0 || n==1) return n...
分类:其他好文   时间:2014-08-03 17:42:35    阅读次数:204
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!