# Tag Archives: prefix-sum

Given an array of positive integer arr[] of length N and an integer Z, (Z > arr[i] for all 0 ≤ i ≤ N –… Read More
Given a binary string S of size N, the task is to find the minimum number of removal required either from the start or end… Read More
Given an array A[] of N positive integers and 3 integers X, Y, and Z, the task is to check if there exist 4 indices… Read More
Given a strictly increasing array A[] of size N, an integer K and Q queries of type [L, R], the task is to count the… Read More
Given an array Arr[] of size N, the cost of removing ith element is Arr[i]. The task is to remove the maximum number of elements… Read More
Given Q queries in the form of a 2D array arr[][] in which every row consists of two numbers L and R which denotes a… Read More
Given an array arr[] of N integers such that no element is 0 in that array, the task is to find the minimum number of… Read More
Given a binary string S of length N, the task is to find the minimum number of removals to segregate all the 0s and all… Read More
Given an array A[] of size N. The task is to find the minimum value that should be added to the array elements to maximize… Read More
Given an array arr[] of length N, where arr is derived from an array nums[] which is lost. Array arr[] is derived as:  arr[i] =… Read More
Given a binary string S, the task is to find the longest subsequence with that has equal number of 0s and 1s and all the… Read More
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 <… Read More
For a given matrix before[][], the corresponding cell (x, y) of the after[][] matrix is calculated as follows:  res = 0;for(i = 0; i <=… Read More
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… Read More
Given a binary array arr[] of size N, the task is to find the count of distinct alternating triplets. Note: A triplet is alternating if… Read More