码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
poj 3233 Matrix Power Series(等比矩阵求和)
http://poj.org/problem?id=3233 ps转: 用二分方法求等比数列前n项和:即   原理:   (1)若n==0   (2)若n%2==0     (3)若n%2==1 代码如下: LL sum(LL p,LL n) { if(n==0) return 1; i...
分类:其他好文   时间:2014-06-15 20:01:44    阅读次数:210
Combination Sum
题目 Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C un...
分类:其他好文   时间:2014-06-15 20:00:18    阅读次数:185
LeetCode:Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 ...
分类:其他好文   时间:2014-06-15 19:55:39    阅读次数:191
LeetCode——Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree and sum ...
分类:其他好文   时间:2014-06-15 19:26:23    阅读次数:207
Combination Sum II
题目 Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in...
分类:其他好文   时间:2014-06-15 19:24:21    阅读次数:229
Count and Say
题目 The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 i...
分类:其他好文   时间:2014-06-15 18:51:33    阅读次数:220
LeetCode:Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below bin...
分类:其他好文   时间:2014-06-15 09:34:35    阅读次数:226
Multiply Strings
题目 Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. 方法 将num1与0-9相乘的结果存...
分类:其他好文   时间:2014-06-14 06:08:30    阅读次数:229
hdu-4453-Looploop-splay
真的被这道题目恶心到了。。。281行代码。。。比一个模拟题还费事。。。 为了方便起见,在数列的前面和后面都加一个0点。 add x :把第k2+2个点旋转至root1.然后sum[root10]+=x; reverse:把第k1+2个点旋转至root1.然后rev[root10]^=1;  insert x:得到第2个点,然后在第2个点之后插入x。  delete :把第1个点旋...
分类:其他好文   时间:2014-06-14 00:54:26    阅读次数:324
【Leetcode】Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at...
分类:其他好文   时间:2014-06-13 20:36:56    阅读次数:280
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!