Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number. Given [-3, 1, 1, -3, 5], ret ...
分类:
其他好文 时间:
2016-06-09 22:19:04
阅读次数:
243
给定一个整数数组,找到和为零的子数组。你的代码应该返回满足要求的子数组的起始位置和结束位置。比如给出 [-3, 1, 2, -3, 4],返回[0, 2] 或者 [1, 3]. Lintcode上的一道题目,这一题我开始想到的是brute force的方法,求出所有子数组,并判断和是否为0。子数组一 ...
分类:
其他好文 时间:
2016-06-02 23:21:16
阅读次数:
138
leetcode 209 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' ...
分类:
编程语言 时间:
2016-06-01 21:00:54
阅读次数:
259
题目链接:https://leetcode.com/problems/maximum-product-subarray/
题目:
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, give...
分类:
其他好文 时间:
2016-05-30 15:32:29
阅读次数:
139
题目链接:https://leetcode.com/problems/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 t...
分类:
其他好文 时间:
2016-05-27 12:31:29
阅读次数:
180
在一个数组中找出一个子数组,使得子数组中的数的乘积最大。...
分类:
其他好文 时间:
2016-05-22 12:27:16
阅读次数:
108
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-05-17 19:12:32
阅读次数:
107
题目来源: https://leetcode.com/problems/maximum-product-subarray/ 题意分析: 给定一个数组,这个数组所有子数组都有一个乘积,那么返回最大的乘积。 题目思路: 由于题目输入的都是整型的,所以所有的数相差获得的是最大或者最小值。那么我们同时记录可 ...
分类:
编程语言 时间:
2016-05-10 16:41:48
阅读次数:
416
题目为: 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, ...
分类:
其他好文 时间:
2016-05-09 14:15:45
阅读次数:
149