码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
codechef Three Way Communications 题解
The Chef likes to stay in touch with his staff. So, the Chef, the head server, and the sous-chef all carry two-way transceivers so they can stay in constant contact. Of course, these transceivers have...
分类:其他好文   时间:2014-05-10 09:11:21    阅读次数:334
CareerCup之1.3字符串去重
【题目】 原文: 1.3 Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of...
分类:其他好文   时间:2014-05-07 08:48:12    阅读次数:372
hdu 3038 (并查集)
题目大意: 给出m个询问,问【l,r】之间的和   ,求出有多少次询问不和之前的矛盾的。 思路分析: 用并查集记录当前节点到根节点的和。 #include #include #include #include #define maxn 222222 using namespace std; int set[maxn]; int sum[maxn]; in...
分类:其他好文   时间:2014-05-07 07:35:05    阅读次数:386
zoj 3781 Paint the Grid Reloaded (比较隐含的最短路)
Paint the Grid Reloaded Time Limit: 2 Seconds      Memory Limit: 65536 KB Leo has a grid with N rows and M columns. All cells are painted with either black or white initially. Two cells A ...
分类:其他好文   时间:2014-05-07 07:28:35    阅读次数:480
leetcode第一刷_Binary Tree Maximum Path Sum
这是道好题。...
分类:其他好文   时间:2014-05-07 06:33:00    阅读次数:284
HDU 1850 Being a Good Boy in Spring Festival (Nim游戏变形)
题意:经典Nim游戏博弈,给你n堆牌,每堆a[i]张,每次能从一堆中取出任一张(不能为0),最后不能取者为输 问先手有几种取法保证他最后能获胜。 思路:让Nim_sum=0(a[1]^a[2]…………^a[n]=0)时则输,利用这个定理,对于第i堆a[i],除了第i堆,其它的 Nim_sum=k,如果a[i]>k,则先手从第i堆可以取a[i]-k张牌,让a[i]=k,最后a[i]^k...
分类:编程语言   时间:2014-05-07 06:13:32    阅读次数:428
Gray Code
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 number of bits in the code, print the sequence of gr...
分类:其他好文   时间:2014-05-07 06:10:17    阅读次数:370
【Leetcode】Two Sum
[Question] Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to t...
分类:其他好文   时间:2014-05-07 05:37:44    阅读次数:278
NYOJ 640 Geometric Sum
NYOJ 640 Geometric Sum...
分类:其他好文   时间:2014-05-06 15:20:32    阅读次数:229
【Leetcode】3Sum
【Question】 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in ...
分类:其他好文   时间:2014-05-06 14:57:29    阅读次数:318
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!