# Tag Archives: array-range-queries

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[] consisting of N integers and an array Queries[] consisting of Q queries of the type {X, L, R} to perform following… Read More
Given an array arr[] of size N and a 2D array Q[][], consisting of queries of the following two types: 1 X Val: Update arr[X]… Read More
Given an array arr[] consisting of N 0s and an array Q[][] with each row of the form (L, R)., the task for each query… Read More
Given an array arr[] of size N, and an array Q[][] with each row representing a query of the form { X, Y }, the… Read More
Given a binary array arr[] of size N and a 2D array Q[][] containing K queries of the following two types: 1 : Print the… Read More
Mo’s Algorithm is a generic algorithm. It can be used in many problems that require processing range queries in a static array, i.e., the array… Read More
Given a string str consisting of N lowercase characters and an array Q[][] with each row of the form {l, r} representing a query. For… Read More
Given a 2D matrix mat[][] of size N * M, the task is to find the median of Bitwise XOR of all possible submatrices from… Read More
Given an array arr[] consisting of N elements and an arrayQ[], the task for each query is to find the length of the longest prefix… Read More
Given three integers L, R, and K, the task is to find the maximum sum of K even multiples of 5 from the range [L,… Read More
Given two arrays A[ ] and B[ ] consisting of N integers, where Ai denotes the quantity of sweets of the ith type and Bi… Read More
Given two arrays L[] and R[] of sizes Q, the task is to find the number of composite magic numbers i.e numbers which are both… Read More
Given an array, arr[] of size N, an integer P and a 2D array Q[][] consisting of queries of the following type: 1 L R… Read More
Given a matrix of dimensions N * M and a 2D array Queries[][] with each query of the form {k, r1, c1, r2, c2}, the… Read More