Subarray

LeetcodeCN: 209 - Minimum Size Subarray Sum

Question: Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or ......
LeetcodeCN Subarray Minimum Size 209

[LeetCode] 2334. Subarray With Elements Greater Than Varying Threshold_Hard tag: dp, stack

You are given an integer array nums and an integer threshold. Find any subarray of nums of length k such that every element in the subarray is greater ......

LeetCode-Java题解 209. Minimum Size Subarray Sum

题目地址:209. Minimum Size Subarray Sum 解题思路: 看到这道题,心里本身是有双指针这个概念的,但是不知道怎么用,脑子里第一反应就是暴力解法,双for一把梭,然后时间就超时了...看了题解才知道滑动窗口这个解法,不禁直呼妙啊!感觉和双指针非常类似,其核心点在于避免了暴力 ......

[LeetCode][152]maximum-product-subarray

# Content Given an integer array nums, find a subarray that has the largest product, and return the product. The test cases are generated so that the ......

[LeetCode][53]maximum-subarray

# Content Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Ou ......

[53]Maximum Subarray

# Content Given an integer array nums, find the subarray with the largest sum, and return its sum. **Example 1:** **Input:** nums = [-2,1,-3,4,-1,2,1, ......
Subarray Maximum 53

Codechef - Longest AND Subarray(位运算)

题目大意 给定一个正整数N,其序列为[1, 2, 3, ..., N],找到一个长度最大的连续子列,使得其所有元素取与运算的结果为正(最终输出只需要输出最大长度即可)。 思路 刚开始可能并不好注意到,可以举一些小的样例来找规律。比如2:1 & 2 = 0,不满足条件,所以只能取长度为1的数组[1]或 ......
Codechef Subarray Longest AND

Leetcode No.53 Maximum Subarray

参考资料: 考点:子串 & 动态规划 & [题干] Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Explanation: The subarray [4,-1,2,1] has the largest sum 6. 1. 心路历程 这道题非常经典, ......
Leetcode Subarray Maximum 53 No

Leetcode 209. 长度最小的子数组(Minimum size subarray sum)

[题目链接](https://leetcode.cn/problems/minimum-size-subarray-sum) 给定一个含有 n 个正整数的数组和一个正整数 target 。 找出该数组中满足其和 ≥ target 的长度最小的 连续子数组 [numsl, numsl+1, ..., ......
数组 长度 Leetcode subarray Minimum

918. Maximum Sum Circular Subarray (Medium)

Description 918. Maximum Sum Circular Subarray (Medium) Given a circular integer array nums of length n, return the maximum possible sum of a non-empt ......
Circular Subarray Maximum Medium 918

[LeetCode] 1493. Longest Subarray of 1's After Deleting One Element

Given a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray containing only 1's in the resulti ......
LeetCode Deleting Subarray Element Longest

牛客练习赛112 B qsgg and Subarray

这里介绍两种解法,贪心和二分 核心:只要某一个区间和为0,则所有包含该区间的和都为0 贪心 根据题意是求出所有⊕和为0的子区间的个数,我们按a[i]来分类,每次求出以a[i]为末尾,区间和为0的区间个数,对于a[i]来说,要想u~i的区间和为0,则需要包含所有a[i]中位为1都有0与之对应,如果u~ ......
练习赛 Subarray qsgg 112 and

[LeetCode] 1186. Maximum Subarray Sum with One Deletion

Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, y ......
LeetCode Deletion Subarray Maximum 1186

[LeetCode] 2090. K Radius Subarray Averages

You are given a 0-indexed array nums of n integers, and an integer k. The k-radius average for a subarray of nums centered at some index i with the ra ......
LeetCode Averages Subarray Radius 2090

Leetcode Hot 100 & 560. Subarray Sum Equals K

参考资料: 考点:子串 & [题干] 1 Input: nums = [1,1,1], k = 2 2 Output: 2 这道题说实话看得我一脸懵,第一时间想到的自然是双层循环遍历的一个$O(n^2)$的解法,也就是官方的解法一。但是使用这种解法会超时(Python语言是这样的,评论区有人提到了) ......
Leetcode Subarray Equals Hot 100

codeforces 1796D Maximum Subarray

https://codeforces.com/problemset/problem/1796/D 解题思路 最大子序列问题的变种。记 f[i][j][p] 表示当前i个元素中有j个元素增加x时,以i结尾并且包含p个元素增加x的子序列的最大值。 f[i][j][p] = max(f[i-1][j-1] ......
codeforces Subarray Maximum 1796D 1796
共16篇  :1/1页 首页上一页1下一页尾页