码迷,mamicode.com
首页 >  
搜索关键字:subarray    ( 846个结果
53. Maximum Subarray
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: ...
分类:其他好文   时间:2019-02-18 18:42:41    阅读次数:152
152. Maximum Product Subarray
Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: E ...
分类:其他好文   时间:2019-02-15 01:05:13    阅读次数:201
Leetcode 560.和为k的子数组
和为k的子数组 给定一个整数数组和一个整数 k,你需要找到该数组中和为 k 的连续的子数组的个数。 示例 1 : 输入:nums = [1,1,1], k = 2 输出: 2 , [1,1] 与 [1,1] 为两种不同的情况。 说明 : 思路 灵活使用map来解决问题 ...
分类:编程语言   时间:2019-02-14 13:48:50    阅读次数:182
LC 918. Maximum Sum Circular Subarray
Given a circular array C of integers represented by A, find the maximum possible sum of a non-empty subarray of C. Here, a circular array means the en ...
分类:其他好文   时间:2019-02-12 15:50:51    阅读次数:185
LC 992. Subarrays with K Different Integers
Given an array A of positive integers, call a (contiguous, not necessarily distinct) subarray of A good if the number of different integers in that su ...
分类:其他好文   时间:2019-02-10 23:33:31    阅读次数:293
LeetCode 209 Minimum Size Subarray Sum 最小子数组和问题
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguoussubarray of which the sum ≥ s. If there isn't o ...
分类:编程语言   时间:2019-02-10 12:29:27    阅读次数:207
19.2.8 [LeetCode 53] Maximum Subarray
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Foll ...
分类:其他好文   时间:2019-02-08 18:36:30    阅读次数:153
LeetCode-152-Maximum Product Subarray
算法描述: Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Exampl ...
分类:其他好文   时间:2019-02-07 12:07:44    阅读次数:187
LC 898. Bitwise ORs of Subarrays
We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i <= j), we take the bitwise OR of al ...
分类:其他好文   时间:2019-02-05 14:20:04    阅读次数:174
Maximum Subarray - LeetCode
[toc] 题目链接 "Maximum Subarray LeetCode" 注意点 最大值有可能是正负数交替着出现 解法 解法一:一次遍历即可。当sum小于0的时候就重新开始求和,因为sum小于0再加上一个数字绝对不可能是max(即sum+nums[i] & nums) { int max = n ...
分类:其他好文   时间:2019-02-05 10:38:40    阅读次数:198
846条   上一页 1 ... 17 18 19 20 21 ... 85 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!