码迷,mamicode.com
首页 >  
搜索关键字:subarray    ( 846个结果
209. Minimum Size Subarray Sum
Problem statement: Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ ...
分类:其他好文   时间:2017-05-19 10:04:30    阅读次数:149
152. Maximum Product Subarray
Problem statement: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the ...
分类:其他好文   时间:2017-05-19 10:02:32    阅读次数:169
53. Maximum Subarray
Problem statement: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the arr ...
分类:其他好文   时间:2017-05-19 00:51:54    阅读次数:130
使用分治算法求解最大子数组问题
def MaxCrossSubarray(num,mid,low,high): leftsum=0 leftmax=-1000000 rightsum=0 rightmax=-1000000 for i in range(mid,low-1,-1): leftsum=leftsum+num[i] i... ...
分类:编程语言   时间:2017-05-18 13:31:35    阅读次数:224
[LeetCode] Split Array with Equal Sum 分割数组成和相同的子数组
Given an array with n integers, you need to find if there are triplets (i, j, k) which satisfies following conditions: where we define that subarray ( ...
分类:编程语言   时间:2017-05-15 00:42:43    阅读次数:222
算法(10)Subarray Sum Equals K
题目:在数组中找到一个子数组,让子数组的和是k。 思路:先发发牢骚,这两天做题是卡到不行哇,前一个题折腾了三天,这个题上午又被卡住,一气之下,中午睡觉,下午去了趟公司,竟然把namespace和cgroup的架构给搞懂了!所以晚上再来攻克这个问题!上午的做法是这样的,设置一个fast指针,一个slo ...
分类:编程语言   时间:2017-05-14 01:09:15    阅读次数:184
325. Maximum Size Subarray Sum Equals k
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead. Note: The sum of ...
分类:其他好文   时间:2017-05-12 23:54:03    阅读次数:263
算法(8)Maximum Product Subarray
题目:在一个数组中找到一个子数组,让子数组的乘积最大,比如【2,3,-2,4】返回6 思路:之前自己想到的思路是对于一个int类型的数组,只要负数的个数是偶数,那么乘积肯定是全局乘就可以了,然后对于负数个数是奇数的情况,那么我们就找到最前和最后的一个负数,然后分别计算其前后子数组的乘积就可以了!因为 ...
分类:编程语言   时间:2017-05-10 00:14:22    阅读次数:126
【LeetCode】053. 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,- ...
分类:其他好文   时间:2017-05-07 23:07:54    阅读次数:169
523
Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that ...
分类:其他好文   时间:2017-05-07 17:44:45    阅读次数:165
846条   上一页 1 ... 37 38 39 40 41 ... 85 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!