Tutorials
Courses
Go Premium
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
32.1K+ articles
DSA
20.0K+ articles
Misc
7.8K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Greedy
1.4K+ articles
Searching
1.0K+ articles
subarray
658+ articles
array-range-queries
376+ articles
subarray-sum
192+ articles
prefix-sum
348+ posts
Recent Articles
Popular Articles
Powerful Integers
Last Updated: 05 July 2025
You are given a 2D integer array intervals[][] of length n and integer k, where each intervals[i] = [start, end] represents a closed interval (i.e., all integers from star...
read more
DSA
prefix-sum
DSA
ASCII Range Sum
Last Updated: 28 July 2025
Given a string s consisting of lowercase English letters, identify all characters whose first and last occurrences are at different positions.For each such character, comp...
read more
DSA
prefix-sum
strings
DSA
Top Problems on Prefix Sum Technique for Interviews
Last Updated: 23 July 2025
The Prefix Sum Technique is a powerful and widely used approach in coding interviews, especially for optimizing queries related to subarray sums and cumulative computation...
read more
DSA
prefix-sum
CSES Solutions - Forest Queries
Last Updated: 23 July 2025
Given an N X N grid representing the map of a forest. Each square is either empty or contains a tree. The upper-left square has coordinates (1,1), and the lower-right squa...
read more
Competitive Programming
Picked
prefix-sum
CSES Problems
CSES Solutions – Static Range Sum Queries
Last Updated: 23 July 2025
Given an array arr[] of N integers, your task is to process Q queries of the form: what is the sum of values in range [a,b]?ExamplesInput: arr[] = {1, 3, 4, 8, 6, 1, 4, 2}...
read more
Competitive Programming
array-range-queries
prefix-sum
CSES Problems
CSES Solutions - Subarray Sums II
Last Updated: 23 July 2025
Given an array arr[] of N integers, your task is to count the number of subarrays having sum X.Examples: Input: N = 5, X = 7, arr[] = {2, -1, 3, 5, -2}Output: 2Explanation...
read more
Competitive Programming
Picked
prefix-sum
CSES Problems
Find the sum of elements after X deletions and Y sign inversions
Last Updated: 23 July 2025
Two Players A and B are engaged in a game with an array of positive integers arr[] of size N. The game starts with Player A deleting at max X elements from the array arr[]...
read more
Sorting
DSA
Arrays
prefix-sum
Maximize number of indices with prefix sum equal to 0
Last Updated: 10 April 2024
Given an array arr[] of size N, you can perform the following operation on the array any number of times: If arr[i]=0, we can replace it with any integer. Your task is to ...
read more
Picked
DSA
prefix-sum
Algorithms-Dynamic Programming
Geeks Premier League 2023
Rearrange the given array to minimize the indices with prefix sum at least arr[i]
Last Updated: 23 July 2025
Given an array arr[] consisting of N positive integers, rearrange the array to minimize the number of indices i such that the prefix sum from index 1 to index i-1 is great...
read more
Geeks Premier League
DSA
Arrays
prefix-sum
Arrays
DSA-Blogs
Geeks Premier League 2023
Connect through Content 2023
Minimum number of operations required to make all the elements positive
Last Updated: 04 April 2024
Given an array A[] of length N. You can apply the below operation:Choose an index i such that (i+1) element exists. After that choose any number X (positive or negative). ...
read more
DSA
prefix-sum
LIS
Arrays
CPP-Competitive-Programming
DSA-Blogs
Geeks Premier League 2023
Queries to find number of indexes where characters repeated twice in row in substring L to R
Last Updated: 23 July 2025
Given string S of size N consisting of lower case characters and 2d array Q[][2] of size M representing several queries of type {L, R} representing a range. The task for ...
read more
Strings
Geeks Premier League
DSA
Arrays
prefix-sum
Geeks Premier League 2023
Queries to find Maximum index R with bitwise AND from index L at least K
Last Updated: 23 July 2025
Given array A[] of size N and array Q[][2] of size M representing queries of the type {L, K}. The task for this problem is to answer queries for each query to find the lar...
read more
Geeks Premier League
DSA
Arrays
Binary Search
prefix-sum
Geeks Premier League 2023
Minimize the Sum of Absolute Costs of an Array Optimally
Last Updated: 18 January 2024
Given an array arr[] of costs, your task is to minimize the sum of the absolute differences between consecutive costs by performing following operation at most once. Opera...
read more
DSA
prefix-sum
math
Data Structures-Array
suffix-sum
Bitwise OR Triplets in a Binary String
Last Updated: 23 July 2025
Given a binary string S of length N, where S[i] represents an integer value. the task is to count the number of ways to choose three different indices ( 0 = i j k N) su...
read more
Strings
Geeks Premier League
DSA
prefix-sum
Geeks Premier League 2023
Minimum operations require to balance Binary String
Last Updated: 23 July 2025
Given a binary string S of length N, the task is to find the minimum number of operations required to balance (equal number of '0' and '1') the given binary string, you ca...
read more
Strings
Geeks Premier League
DSA
prefix-sum
Geeks Premier League 2023
1
2
3
4
...
24
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 !