Given an array arr[] consisting of positive integers and an array Q[][] consisting of queries, the task for every ith query is to count array… Read More

# Tag Archives: prefix-sum

Maximize difference between the sum of absolute differences of each element with the remaining array

Given an array arr[] consisting of N integers, the task is to maximize the difference between the sum of absolute difference of an element with… Read More

Given a sorted array arr[] of size N (1 ≤ N ≤ 105) and two integers A and B, the task is to calculate the… Read More

Given an array arr[] of size N and an array Q[] consisting of M integers, each representing a query, the task for each query Q[i]… Read More

Given an array, arr[] size N, the task is to find the smallest index of the array such that the sum of all the array… Read More

Given an array arr[] consisting of N integers whose absolute values are distinct and an integer K, the task is to find such an arrangement… Read More

Given an array arr[] of size N, the task is to find a value for each index such that the value at index i is… Read More

Given an array arr[] of size N, the task is to find the sum of the floor value of (arr[i] / arr[j]) for all pairs… Read More

Given an array arr[] of even length N and an integer K, the task is to minimize the count of replacing array elements by an… Read More

Given an integer N denoting the number of flights and array bookings[][3] with each row of the form {a, b, K} denoting that there are… Read More

Given an array arr[] of size N, the task is to find indices of array elements whose removal makes the sum of odd and even… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to find the number of times the absolute difference between… Read More

Given a binary matrix mat[][] of size M * N and Q queries of the form {pi, pj, qi, qj}, the task for each query… Read More