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-10-02 15:21:59
阅读次数:
152
原文链接: http://blog.csdn.net/shanyongxu/article/details/46765267 数组作为参数 数组可以作为参数传递给方法,也可以从方法中返回.要返回一个数组,只需要把数组声明为返回类型. static void Main(string[] args) { ...
分类:
编程语言 时间:
2017-09-27 17:43:18
阅读次数:
219
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-09-27 11:28:47
阅读次数:
216
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't ...
分类:
其他好文 时间:
2017-09-27 10:06:37
阅读次数:
152
https://leetcode.com/problems/maximum-subarray/description/ Find the contiguous subarray within an array (containing at least one number) which has th ...
分类:
其他好文 时间:
2017-09-22 00:40:13
阅读次数:
219
这道题为简单题 题目: 思路: 遍历列表,找到局部最优m和全局最优n 代码: ...
分类:
其他好文 时间:
2017-09-22 00:40:06
阅读次数:
186
这道题为简单题 题目: 思路: 我先把前k个数加起来计算平均值,然后遍历列表从索引(k, len(nums)),每次列表向右移动一次就把最左边的的元素减去再加上最新的这个元素,计算总值再求平均值,并与之前的最大值比较,遍历结束后可得最大值。 代码: ...
分类:
其他好文 时间:
2017-09-21 18:02:16
阅读次数:
137
原题链接在这里:https://leetcode.com/problems/maximum-average-subarray-i/description/ 题目: Given an array consisting of n integers, find the contiguous subarra ...
分类:
其他好文 时间:
2017-09-18 14:48:15
阅读次数:
148
#week2# #from leetcode# Description Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For examp ...
分类:
其他好文 时间:
2017-09-18 00:18:48
阅读次数:
259
Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the ...
分类:
其他好文 时间:
2017-09-17 16:27:05
阅读次数:
116