码迷,mamicode.com
首页 >  
搜索关键字:median of two sor    ( 12209个结果
Recover Binary Search Tree leetcode java
题目:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space....
分类:编程语言   时间:2014-08-05 05:17:28    阅读次数:265
Metric Space
Metric spaces is a large class of spaces on which the closeness of two points is depicted by a distance function, or called a metric. Metric spaces ar...
分类:其他好文   时间:2014-08-05 03:04:28    阅读次数:220
LeetCode第四题,Add Two Numbers
题目原文: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it ...
分类:其他好文   时间:2014-08-05 00:51:58    阅读次数:257
Leetcode--Divide Two Integers
Problem Description: Divide two integers without using multiplication, division and mod operator. 分析:题目意思很容易理解,就是不用乘除法和模运算求来做除法,很容易想到的一个方法是一直做减法,然后计数,但是提交之后显示超时,在网上找到一种解法,利用位运算,意思是任何一个整数可以表示成以2的幂为...
分类:其他好文   时间:2014-08-04 21:33:28    阅读次数:307
[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
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!