码迷,mamicode.com
首页 >  
搜索关键字:subarray    ( 846个结果
[leetcode 560. Subarray Sum Equals K]
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = ...
分类:其他好文   时间:2017-05-06 20:54:30    阅读次数:186
leetcode 209. Minimum Size Subarray Sum
https://leetcode.com/problems/minimum-size-subarray-sum/#/description 题目很简单。题意就是求字符串中长度最小的一个子串(子串和大于等于s) 其实感觉直接暴力也可以写,但题目有提示用两个指针,感觉两个指针写,更飘逸一些。 一个end ...
分类:其他好文   时间:2017-05-06 14:10:07    阅读次数:121
[LeetCode]Minimum Size Subarray Sum
题目:Minimum Size Subarray Sum 给定一个整数数组,和一个值,找到一个连续子序列,使其和>=给定的值,且该子序列长度最短。 思路1: 时间复杂度O(n),空间复杂度O(1)的解法。 使用首尾两个指针,求出两个指针之间的数据之和;当和大于等于s时,比较序列长度和最小值,然后,增 ...
分类:其他好文   时间:2017-05-01 20:51:00    阅读次数:225
560. Subarray Sum Equals K
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. 示例: Note: 题解: 看着题目的注意事项就 ...
分类:其他好文   时间:2017-04-30 16:16:17    阅读次数:160
[leetcode-560-Subarray Sum Equals K]
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.Example 1:Input:nums = [1 ...
分类:其他好文   时间:2017-04-30 14:03:25    阅读次数:221
【LeetCode】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, ...
分类:其他好文   时间:2017-04-18 20:56:29    阅读次数:153
leetcode ---双指针+滑动窗体
一:Minimum Size Subarray Sum(最小长度子数组的和O(N)) 题目: Given an array of n positive integers and a positive integer s, find the minimal length of a subarray o ...
分类:Windows程序   时间:2017-04-17 16:00:04    阅读次数:257
41. leetcode 53. Maximum Subarray
53. Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the a ...
分类:其他好文   时间:2017-04-09 22:05:30    阅读次数:162
leetCode 53: Maximum Subarray
题目如下: 原型:最大连续和问题 《算法竞赛入门经典》模版: 本题代码: ...
分类:其他好文   时间:2017-04-01 21:13:14    阅读次数:166
AS 数组内两个最大的和
public class Arrays { int MaxSubArray(int[] A, int n) {int maxSum =A[0]; int currSum = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { ...
分类:编程语言   时间:2017-03-17 23:41:01    阅读次数:198
846条   上一页 1 ... 38 39 40 41 42 ... 85 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!