码迷,mamicode.com
首页 >  
搜索关键字:combination sum    ( 21657个结果
字典树-百度之星-Xor Sum
分析:暴力要超时,所以把每个数字转换为长度为32的0-1字符串,用字典树。因为其公共前缀的特性,空间上可以承受。因为是二叉树,用node[SIZE][2]存放。不知道new速度是否会慢很多,所以没用指针。...
分类:其他好文   时间:2014-05-18 18:37:37    阅读次数:218
求树的最大路径和
求树的最大路径和(Binary Tree Maximum Path Sum)...
分类:其他好文   时间:2014-05-18 18:25:41    阅读次数:235
[LeetCode]4Sum
4Sum Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target....
分类:其他好文   时间:2014-05-18 13:49:09    阅读次数:306
LeetCode 016 3Sum Closest
【题目】 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {...
分类:其他好文   时间:2014-05-18 10:37:57    阅读次数:269
LeetCode 017 4Sum
【题目】 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending ord...
分类:其他好文   时间:2014-05-18 08:46:04    阅读次数:227
[LeetCode]3Sum Closest
3SumClosest Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution....
分类:其他好文   时间:2014-05-18 05:57:48    阅读次数:244
2014百度之星第三题Xor Sum
Xor Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 4445    Accepted Submission(s): 652 Problem Description Zeus 和 Prometheus 做了一个游戏,...
分类:其他好文   时间:2014-05-18 05:21:59    阅读次数:277
leetcode -day17 Path Sum I II & Flatten Binary Tree to Linked List & Minimum Depth of Binary Tree
1、 ?? 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...
分类:其他好文   时间:2014-05-18 03:25:06    阅读次数:301
【LeetCode】Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:其他好文   时间:2014-05-18 02:11:19    阅读次数:302
hdu1166敌兵布阵
1 //Accepted 250MS 2480K 2 #include 3 #include 4 const int MAXN = 50005; 5 struct node 6 { 7 int l,r; 8 int add,sum; 9 }f[3*MAXN];10 int n;...
分类:其他好文   时间:2014-05-17 20:36:37    阅读次数:316
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!