码迷,mamicode.com
首页 >  
搜索关键字:subarray    ( 846个结果
第七节 数和数组
1.subArray问题 通常先转化成前缀和数组,在求解对应问题。 2. two sum a.哈希表的方法:要想明白如何处理数组中两个相同的数相加等于target的情况。 b.掌握two pointers 方法 3.two pointers 应用的问题: two sum及其follow up; so ...
分类:编程语言   时间:2016-10-13 21:16:02    阅读次数:127
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, ...
分类:其他好文   时间:2016-10-11 11:08:58    阅读次数:130
HackerRank-Longest Subarray
...
分类:其他好文   时间:2016-09-30 01:54:47    阅读次数:114
209. Minimum Size Subarray Sum
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return ...
分类:其他好文   时间:2016-09-27 14:49:55    阅读次数:117
124. Binary Tree Maximum Path Sum
感觉和53.maximum subarray有相似处,维护一个localMax,一个globalMax localMax是指左右只选一条的max,简单表示是Math.max(left, right) + nums[i].其实left和right的值因为可能是负数,所以left/right的值是0或者 ...
分类:其他好文   时间:2016-09-27 08:05:02    阅读次数:245
209. Minimum Size Subarray Sum
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return ...
分类:其他好文   时间:2016-09-26 06:25:17    阅读次数:129
leetcode 53 Maximum Subarray
public class Solution { public int maxSubArray(int[] nums) { int res = -1000000; int sum=0; for(int i=0; i<nums.length; i++){ sum += nums[i]; if(sum > ...
分类:其他好文   时间:2016-09-24 16:12:11    阅读次数:135
两头指针问题
Minimum Size Subarray Sum** Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s ...
分类:其他好文   时间:2016-09-23 13:04:54    阅读次数:119
重做53. 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, ...
分类:其他好文   时间:2016-09-22 06:35:29    阅读次数:125
152. Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],t ...
分类:其他好文   时间:2016-09-22 06:33:15    阅读次数:193
846条   上一页 1 ... 41 42 43 44 45 ... 85 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!