Tutorials
Courses
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
DSA
22.8K+ articles
Misc
8.8K+ articles
Mathematical
7.8K+ articles
Arrays
6.5K+ articles
Searching
1.7K+ articles
Dynamic Programming
1.6K+ articles
subarray
658+ articles
prefix-sum
346+ articles
sliding-window
204+ articles
subarray-sum
192+ posts
Recent Articles
Popular Articles
Longest unique subarray of an Array with maximum sum in another Array
Last Updated: 11 February 2022
Given two arrays X[] and Y[] of size N, the task is to find the longest subarray in X[] containing only unique values such that a subarray with similar indices in Y[] shou...
read more
Greedy
Searching
Mathematical
C++ Programs
Data Structures
C++
Algo Geek
Algo-Geek 2021
DSA
Arrays
sliding-window
subarray-sum
Minimize difference between maximum and minimum Subarray sum by splitting Array into 4 parts
Last Updated: 26 October 2023
Given an array arr[] of size N, the task is to find the minimum difference between the maximum and the minimum subarray sum when the given array is divided into 4 non-empt...
read more
DSA
Arrays
prefix-sum
subarray
two-pointer-algorithm
subarray-sum
Minimize sum of an Array by swapping a Subarray with another Array
Last Updated: 06 December 2022
Given two arrays A[] and B[] each of size N, the task is to minimize the sum of an array by swapping a subarray.Examples:Input: A[] = {10, 30, 10, 60, 20}, B[] = {40, 10, ...
read more
Greedy
DSA
Arrays
subarray
subarray-sum
Maximum Subarray sum of Prime length
Last Updated: 24 January 2023
Given an array arr[] of size N, the task is to find the maximum subarray sum that can be obtained such that the length of the subarray should be prime.Examples :Input: arr...
read more
DSA
Arrays
Prime Number
subarray-sum
Maximum Sum of two non-overlapping Subarrays of any length
Last Updated: 03 August 2022
Given an array A consisting of N integers, the task is to find the maximum sum of two non-overlapping subarrays of any length of the array.Note: You can select empty subar...
read more
Greedy
Competitive Programming
TrueGeek
DSA
Arrays
subarray
subarray-sum
Maximize sum by selecting contiguous elements from each row or column
Last Updated: 30 November 2022
Given a matrix mat[][] of size M x N where mat[i][j], the task is to find the maximum possible sum by picking contiguous elements from each or from each column.Note: It is...
read more
Greedy
Matrix
Technical Scripter
Technical Scripter 2022
DSA
Kadane
subarray-sum
Check if every Subarray of even length has sum 0
Last Updated: 28 April 2025
Given an array A[ ] of size N, the task is to check if the sum of every even-sized subarray is 0 or not.Examples:Input: N = 4, A[] = {8, -8, 7, 9}Output: NOExplanation: Su...
read more
Technical Scripter
Technical Scripter 2022
DSA
Arrays
subarray-sum
Maximum Subarray sum of A[] by adding any element of B[] at any end
Last Updated: 17 April 2024
Given two arrays A[] and B[] having lengths N and M respectively, Where A[] and B[] can contain both positive and negative elements, the task is to find the maximum sub-ar...
read more
Technical Scripter
Technical Scripter 2022
DSA
Arrays
Kadane
subarray-sum
Maximize non decreasing Array size by replacing Subarray with sum
Last Updated: 11 July 2024
Given an array arr[] of size N. In one operation only one subarray can be selected and replaced with the sum of the subarray. The task is to find the maximum size of the a...
read more
Greedy
Technical Scripter
Technical Scripter 2022
DSA
Arrays
subarray-sum
Subarray with exactly K positive sum
Last Updated: 18 September 2023
Given two integer values N and K, the task is to create an array A of N integers such that number of the total positive sum subarrays is exactly K and the remaining subarr...
read more
DSA
Arrays
subarray
subarray-sum
Build Array of length N such that exactly X Subarrays have positive sums
Last Updated: 24 July 2023
Given integers N and X, the task is to construct an array of size N such that exactly X subarrays have positive sums and other subarrays have negative sums.Note: If multip...
read more
Competitive Programming
DSA
Arrays
Arrays
subarray-sum
C++ Program for Size of The Subarray With Maximum Sum
Last Updated: 12 May 2023
An array is given, find length of the subarray having maximum sum.Examples :Input : a[] = {1, -2, 1, 1, -2, 1}Output : Length of the subarray is 2Explanation: Subarray wi...
read more
Dynamic Programming
C++ Programs
C++
DSA
Arrays
subarray
subarray-sum
Java Program for Size of The Subarray With Maximum Sum
Last Updated: 10 May 2023
An array is given, find the length of the subarray having maximum sum.Examples:Input : a[] = {1, -2, 1, 1, -2, 1}Output : Length of the subarray is 2Explanation: Subarray...
read more
Java
Dynamic Programming
Java Programs
DSA
Arrays
subarray
subarray-sum
Python3 Program for Size of The Subarray With Maximum Sum
Last Updated: 05 September 2024
An array is given, find length of the subarray having maximum sum.Examples :Input : a[] = {1, -2, 1, 1, -2, 1}Output : Length of the subarray is 2Explanation: Subarray wi...
read more
Dynamic Programming
Python
Python Programs
DSA
Arrays
subarray
subarray-sum
Maximum Subarray Length with Divisibility and Sum Constraint
Last Updated: 11 November 2023
Given two integers N, K, and two arrays A and B each of size N, such that for every index i, A[i] lies between [1, 104] and B[i] lies between [1, 109]. Find the maximum su...
read more
Competitive Programming
DSA
Arrays
sliding-window
Data Structures
two-pointer-algorithm
subarray-sum
1
2
3
4
...
13
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !