# Tag Archives: array-range-queries

Given an integer m and n ranges (e.g. [a, b]) which are intersecting and overlapping. The task is to find all the number within the… Read More
Given N segments as ranges [L, R] where ranges are non-intersecting and non-overlapping. The task is to find all number between 1 to M that… Read More
Pre-requisites: Segment Tree Given an array of digits arr[]. Given a number of range [L, R] and a digit X with each range. The task… Read More
Given an array A having N elements and two integers L and R where, and . You can choose any element of the array (let’s say ax)… Read More
Given N ranges of L-R. The task is to print the number which occurs the maximum number of times in the given ranges. Note: 1 <=… Read More
Given N ranges and Q queries consisting of numbers. Every range consists of L and R. The task is to check if the given number… Read More
Given Q queries and an empty list. The queries can be of two types:   addToList(x) : Add x to your list. removeFromList(x) : Remove x from… Read More
Given an array arr[0 . . . n-1]. The task is to perform the following operation:  Find the maximum of elements from index l to… Read More
Given an array of N positive integers. The task is to perform the following operations according to the type of query given. 1. Print the maximum… Read More
Prerequisites: Fenwick Tree (Binary Indexed Tree)Given an array of N numbers, and a number of queries where each query will contain three numbers(l, r and… Read More
We have discussed recursive segment tree implementation. In this post, iterative implementation is discussed.Let us consider the following problem understand Segment Trees.We have an array… Read More
We have an array of integers and a set of range queries. For every query, we need to find product of elements in the given… Read More
Given an array of N integers and Q queries. Every query consists of L and R. The task is to print the second smallest element… Read More
Given an array of size N and Q queries, each query consists of L, R, and K(consider 1 based-indexing for L and R). The task… Read More