Skip to content

Tag Archives: prefix-sum

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
Given string str of size N and two integers M and K (N is divisible by M), the task is to find the Kth non-overlapping… Read More
Given an array arr[] of size N and an integer K, denoting the maximum value an array element can have, the task is to check… Read More
Given an array arr[] of N integers, the task is to divide find all the indices such that prefix sum (i.e. sum of elements in… Read More
Given an array, arr[] of size N and a positive integer D, the task is to find the position i of an element in arr[]… Read More
Given an array arr[] of size N, the task is to find an index i such that the difference between prefix average and suffix average… Read More
Given an array arr[] of length N, the task is to find the largest sum contiguous subarray by adding an integer S exactly at K… Read More
Given an array arr[] having N positive integers, the task is to find all the indices i (1 ≤ i ≤ N – 1) such… Read More
Given a binary array nums of length N, The task is to find all possible partitions in given array such that sum of count of… Read More

Start Your Coding Journey Now!