码迷,mamicode.com
首页 >  
搜索关键字:maximum sum subarray    ( 25087个结果
Maximum Subarray
题目 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [?2,1,?3,4,?1,2,1,?5,4], the contiguous subarray [4,...
分类:其他好文   时间:2014-06-19 12:08:20    阅读次数:270
Jump Game II
题目 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. ...
分类:其他好文   时间:2014-06-19 11:46:47    阅读次数:277
Jump Game
题目 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. ...
分类:其他好文   时间:2014-06-19 10:05:39    阅读次数:278
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 bin...
分类:其他好文   时间:2014-06-15 09:34:35    阅读次数:226
【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
Leetcode:Path Sum 二叉树路径和
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 giv...
分类:其他好文   时间:2014-06-13 16:09:02    阅读次数:237
NOI2002银河英雄传说
原先就看过这道题,觉得很复杂。不知道为什么今天一看觉得好水啊……难道这就是并查集的启发式合并?数组d【i】表示i到其父节点的距离,即中间隔了多少船舰。数组sum【i】记录以i为根的集合总共有多少个元素,将新节点插入的时候距离设为sum【i】就好了。代码: 1 var fa,d,sum:array[....
分类:其他好文   时间:2014-06-12 09:45:29    阅读次数:145
POJ 1364 King --差分约束第一题
题意:求给定的一组不等式是否有解,不等式要么是:SUM(Xi) (a k (1) 要么是SUM(Xi) (a k,也就是T(a-1)-T(a+b) = K.不存在这个序列的情况即为出现负环,所以这题建图后只需判断有无负环即可。这里用Bellman-Ford算法判负环注意:(1)a-1有可能为0,a....
分类:其他好文   时间:2014-06-12 08:03:35    阅读次数:213
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!