Partitioning into two contiguous element subarrays with equal sums

Given an array of n positive integers. Find a minimum positive element to be added to one of the indexes in the array such that… Read More »

Counting values greater than equal to x after increments

Consider an array of size n with initial 0 values. How many indices will contain value at least x after performing m range updates. In… Read More »

Max sum of M non-overlapping subarrays of size K

Given an array and two numbers M and K. We need to find sum of max M subarrays of size K (non-overlapping) in the array.… Read More »

Maximum average sum partition of an array

Given an array, we partition a row of numbers A into at most K adjacent (non-empty) groups, then the score is the sum of the… Read More »

Maximum equlibrium sum in an array

Given an array arr[]. Find maximum value of prefix sum which is also suffix sum for index i in arr[]. Examples : Input : arr[]… Read More »

Prefix Sum of Matrix (Or 2D Array)

Given a matrix (or 2D array) a[][] of integers, find prefix sum matrix for it. Let prefix sum matrix be psa[][]. The value of psa[i][j]… Read More »

Fibonacci sum of a subset with all elements <= k

Given an array of n elements, the task is to find the fibonacci sum of a subset of the array where every element of the… Read More »

Number of prefix sum prime in given range query

Given an array of non-negative integers and range query l, r, find number of prefix sum which are prime numbers in that given range. Prerequisite… Read More »

Check if it possible to partition in k subarrays with equal sum

Given an array A of size N, and a number K. Task is to find out if it is possible to partition the array A… Read More »

Split array in three equal sum subarrays

Consider an array A of n integers. Determine if array A can be split into three consecutive parts such that sum of each part is… Read More »

Sum of product of each element with each element after it

Given an array arr[] of n integers. The task is to find the sum of product of each element with each element after it in… Read More »

Number of indexes with equal elements in given range

Given N numbers and Q queries, every query consists of L and R, task is to find the number of such integers i (L<=i<R) such… Read More »

Minimum Swaps required to group all 1’s together

Given an array of 0’s and 1’s, we need to write a program to find the minimum number of swaps required to group all 1’s… Read More »

Array Index with same count of even or odd numbers on both sides

Given an array of N integers. We need to find an index such that Frequency of Even numbers on its left side is equal to… Read More »

Substrings starting with vowel and ending with consonants and vice versa

Given a string s, count special substrings in it. A Substring of S is said to be special if either of the following properties is… Read More »