Tutorials
Courses
Go Premium
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.0K+ articles
Misc
7.8K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Bit Magic
821+ articles
Bitwise-XOR
443+ articles
prefix-sum
348+ articles
Advanced Data Structure
305+ articles
Segment-Tree
156+ articles
array-range-queries
376+ posts
Recent Articles
Popular Articles
Minimize XOR with power of 2 to make elements in range equal
Last Updated: 23 July 2025
Given an array A[] of size N (0 ? A[i] ? 109). The following operations can be performed on the array.Choose a random integer X such that it is a power of 2.Choose an inde...
read more
Bit Magic
DSA
Arrays
array-range-queries
prefix-sum
Find the remaining Array element after adding values in given ranges
Last Updated: 14 November 2022
Given an array A[] containing N elements and an array queries containing Q queries of type [ X, L, R ] where X is the element to be added to all the elements in the range ...
read more
DSA
array-range-queries
Minimum operations such that each given segment of String have distinct characters
Last Updated: 08 February 2023
Given a string S of length N, Q ranges of the form [L, R] in a 2-D array range, and a permutation arr[] containing numbers from 1 to N. In one operation, you can remove th...
read more
DSA
array-range-queries
Count of missing elements from 1 to maximum in index range [L, R]
Last Updated: 24 May 2022
Given an array arr[] of length N, and an array queries[] of size Q, the task is to find the number of missing elements from 1 to maximum in the range of indices [L, R] whe...
read more
DSA
array-range-queries
Find the Array formed by performing Q queries on an empty array
Last Updated: 23 July 2025
Consider an integer sequence S, which is initially empty (i.e. S = {}). Also given are Q queries, each of which is one of the following types:1 a b: Insert a and b into th...
read more
Pattern Searching
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
array-range-queries
Binary Search
Count of Array elements in given range with remainder X when divided by K for Q queries
Last Updated: 23 July 2025
Given an array arr[] of size N, an integer K and Q queries, each of form {x, l, r}. For each query, the task is to find the count of all elements in index range [l, r] whi...
read more
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
array-range-queries
prefix-sum
Count of possible remainders for K in given ranges for Q queries
Last Updated: 23 July 2025
Given an array arr[ ] which contains N positive integers and an integer K and a vector of queries Q . Two types of queries can be asked:In the type 1 query, all elements f...
read more
Tree
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
array-range-queries
Segment-Tree
Find largest index till which Bitwise AND of elements is at least X for Q queries
Last Updated: 23 July 2025
Given array of integers arr[] and queries[] of size N and Q, the task is to find the largest index for each query Q[i] such that bitwise AND of each element from starting ...
read more
Bit Magic
Geeks Premier League
Geeks-Premier-League-2022
DSA
array-range-queries
Bitwise-AND
Print all Repetitive elements in given Array within value range [A, B] for Q queries
Last Updated: 23 July 2025
Given an array arr[] of size N, and Q queries of the form [A, B], the task is to find all the unique elements from the array which are repetitive and their values lie betw...
read more
DSA
array-range-queries
Count of empty cells in given square Matrix after updating the rows and columns for Q queries
Last Updated: 23 July 2025
Given a binary matrix of size NxN which is initially filled with 0's and Q queries such that:Each query is of type (r, c) where r and c denotes the row number and column n...
read more
Greedy
Mathematical
Matrix
Geeks Premier League
Geeks-Premier-League-2022
DSA
array-range-queries
Count numbers in given range which are symmetrical when rotated 180 degree clockwise
Last Updated: 23 July 2025
Given a range [L, R), the task is to count the numbers that remain unchanged when rotated 180 degrees clockwise.Examples:Input: L = 0, R =10Output: 3Explanation: Here betw...
read more
Misc
Pattern Searching
Mathematical
DSA
array-range-queries
Check if GCD of [L, R] can be made >1 by replacing pairs with their product at most K times
Last Updated: 23 July 2025
Given a range [L, R] and an integer K, the task is to check if it is possible to make the GCD of all integers in the given range more than 1 using at most K operations whe...
read more
Mathematical
DSA
array-range-queries
GCD-LCM
number-theory
C++ Program to Find Range sum queries for anticlockwise rotations of Array by K indices
Last Updated: 23 July 2025
Given an array arr consisting of N elements and Q queries of the following two types:1 K: For this type of query, the array needs to be rotated by K indices anticlockwise ...
read more
C++
array-range-queries
prefix-sum
rotation
prefix
Java Program to Find Range sum queries for anticlockwise rotations of Array by K indices
Last Updated: 23 July 2025
Given an array arr consisting of N elements and Q queries of the following two types:1 K: For this type of query, the array needs to be rotated by K indices anticlockwise ...
read more
Java
array-range-queries
prefix-sum
rotation
prefix
Python3 Program to Find Range sum queries for anticlockwise rotations of Array by K indices
Last Updated: 23 July 2025
Given an array arr consisting of N elements and Q queries of the following two types:1 K: For this type of query, the array needs to be rotated by K indices anticlockwise ...
read more
Python
array-range-queries
prefix-sum
rotation
prefix
1
2
3
4
...
26
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !