码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
最大子序列和
动态规划的算法:#includeint MaxSubsequenceSum(const int A[],int n){ int i,sum,MaxSum; sum=MaxSum=0; for(i=0;iMaxSum) MaxSum=sum; if...
分类:其他好文   时间:2014-06-18 17:56:31    阅读次数:139
最小公共子序列的和
#includeint MinSubsequenceSum(const int A[],int n){ int i,sum,MinSum; sum=MinSum=0; for(i=0;i0) sum=0; } return MinSum;}void...
分类:其他好文   时间:2014-06-18 17:45:48    阅读次数:173
非递归版求幂函数
#includeint MinSubsequenceSum(const int A[],int n){ int i,sum,MinSum; sum=MinSum=0; for(i=0;i0) sum=0; } return MinSum;}void...
分类:其他好文   时间:2014-06-18 17:45:03    阅读次数:136
[LeetCode] Median of Two Sorted Arrays
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 ...
分类:其他好文   时间:2014-06-18 17:39:11    阅读次数:260
golang中的检验hash
1.对字符串进行hash大家可以看一下, SHA1 HashesGo by Example写道:The pattern for generating a hash is sha1.New(), sha1.Write(bytes), then sha1.Sum([]byte{}). 附上golang代...
分类:其他好文   时间:2014-06-18 16:07:48    阅读次数:294
求1+2+3+...+n的值,要求不能使用乘除法,for、while、if、else、switch、case、等关键字及条件判断语句(JAVA)
采用递归和三目表达式注意红色字体一定不能写成n-- 1 package com.hunag; 2 3 public class Sum { 4 5 static int sum; 6 public static int isum(int n) 7 { 8 ...
分类:编程语言   时间:2014-06-16 23:49:28    阅读次数:456
Divide Two Integers
题目 Divide two integers without using multiplication, division and mod operator. 方法 将除数倍加,直到大于被除数。 public int divide(int dividend, int divisor) { int flag = 0; if...
分类:其他好文   时间:2014-06-16 19:08:08    阅读次数:200
LeetCode:Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. F...
分类:其他好文   时间:2014-06-15 14:51:02    阅读次数:167
[LeetCode] Combinations [38]
题目 Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: [ [2,4], [3,4], [2,3], [1,2], [1,3],...
分类:其他好文   时间:2014-06-15 14:10:54    阅读次数:239
HDU 1661 Assigments 贪心法题解
Problem Description In a factory, there are N workers to finish two types of tasks (A and B). Each type has N tasks. Each task of type A needs xi time to finish, and each task of type B needs yj ti...
分类:其他好文   时间:2014-06-15 11:26:42    阅读次数:195
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!