码迷,mamicode.com
首页 >  
搜索关键字:number    ( 26994个结果
Two Sum
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 nu...
分类:其他好文   时间:2015-07-29 11:40:57    阅读次数:126
【LeetCode-面试算法经典-Java实现】【053-Maximum Subarray(最大子数组和)】
【053-Maximum Subarray(最大子数组和)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题  Find the contiguous subarray within an array (containing at least one number) which has the largest sum.   For example, given the ar...
分类:编程语言   时间:2015-07-29 07:55:12    阅读次数:131
代码块和并发性
代码块对象: 通常称:代码块,是对C语言的扩展,,除了函数中的代码,其害包含变量绑定。代码块有时也被称为闭包(closure)。两种绑定类型:自动型和托管型。自动型使用的是栈中的内存,而托管绑定是通过堆创建的。代码块和函数指针: 代码块特征:1.返回类型可以手动声明也可..
分类:其他好文   时间:2015-07-29 06:37:03    阅读次数:113
hdu 1394 Minimum Inversion Number(线段树)
Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13797    Accepted Submission(s): 8423 Problem Description Th...
分类:其他好文   时间:2015-07-29 01:07:31    阅读次数:150
【leetcode】204 - Count Primes
Description:Count the number of prime numbers less than a non-negative number,n.Hint:Let's start with aisPrimefunction. To determine if a number is pr...
分类:其他好文   时间:2015-07-29 00:34:37    阅读次数:138
poj 2104 K-th Number (主席树)
/* 求l,r这个死序列中第k小的数 */ #include #include # include using namespace std; # define lson l,m # define rson m+1,r # define N 100005 int a[N],Hash[N]; int T[N];///树祖宗节点的编号 int sum[N<<5];//数目 int L[N<<5];...
分类:其他好文   时间:2015-07-28 23:20:12    阅读次数:399
34 - 丑数
题目描述:http://ac.jobdu.com/problem.php?pid=1214 把只包含因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含因子7。 习惯上我们把1当做是第一个丑数。求按从小到大的顺序的第N个丑数。解析: 丑数的定义应该为:质因子只含有2、3、5的数 。1 默认是一个丑数。 e.g. 8 = 2*2*2; 18 = 2...
分类:其他好文   时间:2015-07-28 23:10:18    阅读次数:137
Andy&#39;s First Dictionary
DescriptionAndy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows ...
分类:其他好文   时间:2015-07-28 22:35:22    阅读次数:117
[LintCode] Majority Number(以时间复杂度O(n)求主元素)
一个数据序列的主元素,是指序列中出现次数超过序列长度一半的元素。法1(期望时间复杂度为O(n)):由于主元素出现次数超过序列长度的一半,因此,主元素一定是中位数。可以利用递归划分求中位数的方法,期望时间复杂度为O(n)。法2:显然,如果一个序列存在主元素,那么我们去掉序列中不同的两个数,剩下序列的主...
分类:其他好文   时间:2015-07-28 22:28:41    阅读次数:135
素环数 Prime Ring Problem ,UVa 524
DescriptionA ring is composed of n (even number) circles as shown in diagram. Put natural numbers into each circle separately, and the sum of numbers....
分类:其他好文   时间:2015-07-28 21:01:59    阅读次数:116
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!