码迷,mamicode.com
首页 >  
搜索关键字:median of two sor    ( 12209个结果
1176. Two Ends
题目链接地址:http://soj.me/1176题目大意:两头取数。第一个人随机取,第二个人用贪婪算法(每次都取大的),求两人取数在第一个人赢的情况下的最大分差。使用贪婪算法时,如果左右两边相等,取左边的。核心算法:动态规划。 设数组arr[a][b]是在数列区间[a,b]上的最大分差。 递推公式...
分类:其他好文   时间:2014-10-09 14:57:33    阅读次数:159
cache支持三种pre-fetch方式:normal/pre-fetch1/pre-fetch2-way1/pre-fetch-way2
1.normal fetch ----fetch 1 cache line once2. pre-fetch mode one ---- fetch 3 cache line once3.pre-fetch mode two ----{way1: fetch 3 cache lines once ,...
分类:其他好文   时间:2014-10-09 14:41:14    阅读次数:196
Finding intersection of two sorted arrays
Find the intersection of two sorted arrays.Let’s called array1 as A and array2 as B, each with size m and n.The obvious brute-force solution is to sca...
分类:其他好文   时间:2014-10-09 14:20:13    阅读次数:161
LeetCode Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number...
分类:其他好文   时间:2014-10-09 13:16:43    阅读次数:179
【LeetCode】【Python题解】Container with most water
这道题真真是在面试中碰到过,可惜当时复杂度到O(n2)了,太挫了,怪不得没有通过面试。 Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two en...
分类:编程语言   时间:2014-10-09 01:58:17    阅读次数:229
LeetCode-Swap Nodes in Pairs
题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your al...
分类:其他好文   时间:2014-10-09 00:31:07    阅读次数:234
Median of Two Sorted Arrays
[leetcode]There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n))....
分类:其他好文   时间:2014-10-08 14:00:15    阅读次数:147
UVA - 12338 Anti-Rhyme Pairs (哈希)
DescriptionD Anti-Rhyme Pairs Input: Standard Input Output: Standard Output Often two words that rhyme also end in the same sequence of characters. We...
分类:其他好文   时间:2014-10-08 11:01:35    阅读次数:261
Leetcode: Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t...
分类:其他好文   时间:2014-10-08 07:40:24    阅读次数:228
leetcode--Median of Two Sorted Arrays
Problem:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh...
分类:其他好文   时间:2014-10-08 00:27:44    阅读次数:321
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!