# Tag Archives: array-range-queries

## Segment Trees | (Product of given Range Modulo m)

Let us consider the following problem to understand Segment Trees. We have an array arr[0 . . . n-1]. We should be able to 1… Read More »

## Queries on Left and Right Circular shift on array

Given an array A of N integers. There are three type of type of commands: 1 x : Right Circular Shift the array x times.… Read More »

## Sparse Table

We have briefly discussed sparse table in Range Minimum Query (Square Root Decomposition and Sparse Table) Sparse table concept is used for fast queries on… Read More »

## Products of ranges in an array

Given an array A[] of size N. Solve Q queries. Find the product in range [L, R] under modulo P ( P is Prime). Examples:… Read More »

## Count Primes in Ranges

Given a range [L, R], we need to find the count of total numbers of prime numbers in the the range [L, R] where 0

## Queries on probability of even or odd number in given ranges

Given an array A of size N, containing integers. We have to answer Q queries where each query is of the form: K L R… Read More »

## Array Queries for multiply, replacements and product

This is Range query question in which we have been provided with and array of size N. Given are 3 types of queries and you… Read More »

## Mean of range in array

Given an array of n integers. You are given q queries. Write a program to print floor value of mean in range l to r… Read More »

## Print modified array after executing the commands of addition and subtraction

Given an array of size ‘n’ and a given set of commands of size ‘m’. Every command consist of four integers q, l, r, k.… Read More »

## Find element at given index after a number of rotations

An array consisting of N integers is given. There are several Right Circular Rotations of range[L..R] that we perform. After performing these rotations, we need… Read More »

## Range sum queries without updates

Given an array arr of integers of size n. We need to compute sum of elements from index i to index j. The queries consisting… Read More »

## Array range queries over range queries

Given an array of size n and a give set of commands of size m. The commands are enumerated from 1 to m. These commands… Read More »

## Binary array after M range toggle operations

Consider a binary array consisting of N elements (initially all elements are 0). After that you are given M commands where each command is of… Read More »

## Print modified array after multiple array range increment operations

Given an array containing n integers and a value d. m queries are given. Each query has two values start and end. For each query,… Read More »

## Queries on XOR of greatest odd divisor of the range

Given an array of N positive integers. There are Q queries, each include a range [L, R]. For each query output the xor of greatest… Read More »