Given an integer N representing the total size of groups S, their entry T1 and exit timings T2. This means that group number i will… Read More
Tag Archives: prefix-sum
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… Read More
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… Read More
Given an array A[] and the operation of swapping two elements if their sum is even, find a resulting array B[] such that all prefix… Read More
Given, an array A[] of N integers, and also given two positive integers B and C, the task is to find the number of subarrays,… Read More
Given a matrix mat[][] of size N x N, the task is to count the number of submatrices with the following properties: The sum of… Read More
Given a binary string consisting of 0s and 1s and ‘?’ characters and an integer K, it is allowed to replace ‘?’ with 0 or… Read More
Given an array A[] of N integers and 2 integers X and Y. The task is to minimize the sum of all elements of the… Read More
Given an array arr[] of length, N, the task is to find how many powerful subarrays are present in the array. Note: A powerful subarray… Read More
Given an array arr[]. Find the maximum number of indices having 0 as prefix sums possible by replacing the 0s in the array with any… Read More
Given two arrays A[] and B[] both of size N, the task is to count the number of non-decreasing arrays C[] of size N such… Read More
Given two arrays arr1[] and arr2[] of size N and M (M < N) add all elements of arr2[] in all possible subarrays of arr1[]… Read More
Given two arrays X[] and Y[] of length N each. You can shift from X[] to Y[] at most once. The task is to output… Read More
Given a binary string S consisting of ‘0‘ and ‘1‘ only, the task is to find the maximum possible number of “10” subsequences by replacing… Read More
Given an array arr[] consisting of N integers and an array Q[][3] consisting of M queries of the form [L, R, U], the task for… Read More