码迷,mamicode.com
首页 >  
搜索关键字:subarray    ( 846个结果
leetcode dp
53. Maximum Subarray Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return i ...
分类:其他好文   时间:2018-11-17 19:13:51    阅读次数:196
LeetCode581-最短无序子数组(滑动窗口)
JS做题爽就爽在不用开编辑器 这个题目比较难,毕竟最后是用了On级别的算法 做了下去看来大体上是对的,但是很多地方的小细节出了很多差错,因为是在很困的情况下做的题目 主要就是找到一个窗口,里面最小的数字往左挪动,右边最大的数字往右挪。 不需要真实的交换,只是简单的比较即可。 1、窗口里面的重复数字怎 ...
分类:编程语言   时间:2018-11-17 13:13:35    阅读次数:196
【leetcode】53-MaximumSubarray
problem MaximumSubarray 参考 1. https://leetcode.com/problems/maximum-subarray/description/ 完 ...
分类:其他好文   时间:2018-11-16 15:18:52    阅读次数:227
Leetcode53 Maximum Subarray
就是最基本的DP,先用了最基本的做法。 14ms,19.5%. 稍作改进,不用自带的Math.max。 8ms,99.92%。 ...
分类:其他好文   时间:2018-11-13 11:36:53    阅读次数:141
862. Shortest Subarray with Sum at Least K
Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K. If there is no non-empty subarray with sum at least K, ret ...
分类:其他好文   时间:2018-11-10 18:01:24    阅读次数:244
209. Minimum Size Subarray Sum
1 class Solution { 2 public int minSubArrayLen(int s, int[] nums) { 3 if(nums.length == 0) return 0; 4 int count = 0; 5 int i = 0, j = 0; 6 int min = ... ...
分类:其他好文   时间:2018-11-01 11:49:49    阅读次数:108
【LeetCode】位运算 bit manipulation(共32题)
https://leetcode.com/tag/bit-manipulation/ ...
分类:其他好文   时间:2018-11-01 01:02:44    阅读次数:148
【LeetCode】队列 queue(共8题)
https://leetcode.com/tag/queue/ ...
分类:其他好文   时间:2018-11-01 00:54:43    阅读次数:197
Leetcode-930 Binary Subarrays With Sum(和相同的二元子数组)
1 class Solution 2 { 3 public: 4 int numSubarraysWithSum(vector& A, int S) 5 { 6 if(S==0) 7 { 8 int result = 0; 9 ... ...
分类:编程语言   时间:2018-10-30 21:18:15    阅读次数:480
【算法】LeetCode算法题-Maximum Subarray
这是悦乐书的第 154 次更新,第 156 篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第13题(顺位题号是53)。给定一个整数数组nums,找出一个最大和,此和是由数组中索引连续的元素组成,至少包含一个元素。例如: 输入:[ 2, 1, 3, 4, 1, 2, 1, ...
分类:编程语言   时间:2018-10-28 11:11:37    阅读次数:170
846条   上一页 1 ... 20 21 22 23 24 ... 85 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!