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
Searching
1.0K+ articles
frequency-counting
745+ articles
subarray
658+ articles
prefix-sum
348+ articles
subarray-sum
192+ articles
suffix-sum
25 posts
Recent Articles
Popular Articles
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
Difference summation with Array index matching
Last Updated: 09 August 2023
Given two sorted arrays A and B of size N and M respectively, the task is to find the value V, which is the summation of(A[j] - A[i]) for all pairs of i and j such that (...
read more
DSA
Arrays
prefix-sum
suffix-sum
Counting common prefix/suffix strings in two lists
Last Updated: 22 August 2023
Given two Lists of strings s1 and s2, you have to count the number of strings in s2 which is either a suffix or prefix of at least one string of s1.Examples:Input: s1 = ["...
read more
Strings
DSA
prefix-sum
suffix-sum
Finding absolute difference of sums for each index in an Array
Last Updated: 13 September 2023
Given an array arr[] of size N, find a new array ans[] where each index i represents the absolute difference between the sum of elements to the left and right of index i i...
read more
DSA
Arrays
prefix-sum
Suffix-Array
Arrays
prefix
suffix-sum
Split a String into two Substring such that the sum of unique characters is maximum
Last Updated: 11 April 2023
Given a string str, the task is to partition the string into two substrings such that the sum of unique characters of both substrings is the maximum possible.Examples:Inpu...
read more
DSA
Arrays
prefix
suffix-sum
Minimum cost to make Array equal by increment/decrementing elements
Last Updated: 15 November 2022
Given an array, arr[], and the cost array cost[], the task is to find the minimum cost to make all the array elements equal by incrementing or decrementing the element at ...
read more
Mathematical
Technical Scripter
DSA
Arrays
prefix-sum
suffix-sum
Find a sorted sub-sequence of size 4 in linear time
Last Updated: 06 July 2022
Given an array (arr[]) of N integers, find a subsequence of 4 elements such that a[i] a[j] a[k] a[l] and i j k l in O(N) time. If there are multiple such Quadruplet,...
read more
Mathematical
Picked
DSA
Arrays
prefix-sum
suffix-sum
Suffix Sum Array
Last Updated: 09 November 2023
Suffix Sum ArrayGiven an array arr[] of size N, the task is to compute and return its suffix sum array.Suffix Sum is a precomputation technique in which the sum of all the...
read more
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
suffix-sum
Suffix
Minimum operations to make Array sum at most S from given Array
Last Updated: 07 January 2022
Given an array arr[], of size N and an integer S, the task is to find the minimum operations to make the sum of the array less than or equal to S. In each operation:Any el...
read more
Greedy
Mathematical
Algo Geek
Algo-Geek 2021
DSA
Arrays
suffix-sum
Maximize sum of given array after removing valleys
Last Updated: 23 July 2025
Given an array arr[] of integers of size N, the task is to maximize the sum of the array after removing valleys from the array when only reducing the value of an element i...
read more
Misc
Greedy
Mathematical
DSA
Arrays
Google
prefix-sum
suffix-sum
Find position i to split Array such that prefix sum till i-1, i and suffix sum till i+1 are in GP with common ratio K
Last Updated: 23 July 2025
Given an array, arr[] and a positive integer K. The task is to find the position say i of the element in arr[] such that prefix sum till i-1, i and suffix sum till i+1 are...
read more
Misc
Pattern Searching
Mathematical
DSA
Arrays
prefix-sum
Geometric Progression
suffix-sum
Count of indices up to which prefix and suffix sum is equal for given Array
Last Updated: 23 July 2025
Given an array arr[] of integers, the task is to find the number of indices up to which prefix sum and suffix sum are equal.Example:Input: arr = [9, 0, 0, -1, 11, -1]Outpu...
read more
Greedy
Mathematical
DSA
Arrays
prefix-sum
suffix-sum
Find the suffix factorials of a suffix sum array of the given array
Last Updated: 23 July 2025
Given an array arr[] consisting of N positive integers, the task is to find the suffix factorials of a suffix sum array of the given array.Examples:Input: arr[] = {1, 2, 3...
read more
DSA
factorial
suffix-sum
Suffix
Find the array element having equal sum of Prime Numbers on its left and right
Last Updated: 23 July 2025
Given an array arr[] of size N, the task is to find the index in the given array where the sum of the prime numbers present to its left is equal to the sum of the prime nu...
read more
Searching
Mathematical
Hash
DSA
Arrays
prefix-sum
sieve
Prime Number
suffix-sum
Find the array element having equal count of Prime Numbers on its left and right
Last Updated: 23 July 2025
Given an array arr[] consisting of N positive integers, the task is to find an index from the array having count of prime numbers present on its left and right are equal.E...
read more
Searching
Mathematical
Hash
DSA
Arrays
prefix-sum
sieve
Prime Number
cpp-unordered_map
frequency-counting
suffix-sum
1
2
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 !