码迷,mamicode.com
首页 >  
搜索关键字:median of two sorted    ( 17004个结果
HDU 3308 LCIS(线段树)
Problem DescriptionGiven n integers.You have two operations:U A B: replace the Ath number by B. (index counting from 0)Q A B: output the length of the...
分类:其他好文   时间:2014-05-06 01:20:33    阅读次数:332
Leetcode | Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.想法很简单,就是两两合并。在Merge Two Sorted Lists这道题已经实现了两两合并的代码了,就...
分类:其他好文   时间:2014-05-06 00:22:01    阅读次数:337
Add Binary
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".思路:一个二进制字符串相加;首先从字符串的末尾开始,先二进制字符转化为数字,然后再相加;然后将...
分类:其他好文   时间:2014-05-05 23:10:15    阅读次数:319
Leetcode: Remove Duplicates from Sorted List
遇到的问题:input{1,1,1}, output{1,1}, expected{1}, 原因在于若temp.val==temp.next.val, 则需要temp.next=temp.next.next, 这时候就不要temp=temp.next了注意停止条件不光是temp!=null,还应该有...
分类:其他好文   时间:2014-05-05 22:47:08    阅读次数:454
Swap Nodes in Pairs
Link:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2-...
分类:其他好文   时间:2014-05-05 22:45:37    阅读次数:331
【LeetCode OJ】Word Ladder I
Problem Link:http://oj.leetcode.com/problems/word-ladder/Two typical techniques are inspected in this problem:Hash Table. One hash set is the words di...
分类:其他好文   时间:2014-05-05 22:44:44    阅读次数:393
redis在windows下安装和PHP中使用
windows下安装redis1、redis简介redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hashs(哈希类型)。这些数据类型...
分类:Windows程序   时间:2014-05-04 12:37:46    阅读次数:848
codechef Sums in a Triangle题解
Let's consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three in the third line, etc. Develop a program which will compute the largest ...
分类:其他好文   时间:2014-05-03 17:32:22    阅读次数:284
codechef The Lead Game 题解
The game of billiards involves two players knocking 3 balls around on a green baize table. Well, there is more to it, but for our purposes this is sufficient. The game consists of several rounds ...
分类:其他好文   时间:2014-05-03 16:15:33    阅读次数:296
codechef Enormous Input Test 快速读入数据 fread
本题就是测试读入数据的速度的。 如果有大量的数据读入,使用cin是很慢的。 那么使用scanf那么会快很多,但是如果数据量更大的话那么就还是不够快了。 所以这里使用fread。 首先开一个buffer,然后使用fread大块大块地读入数据就可以非常快地读入了。 题目如下: Input The input begins with two positive...
分类:其他好文   时间:2014-05-03 16:13:21    阅读次数:340
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!