## Count of distinct numbers in an Array in a range for Online Queries using Merge Sort Tree

Given an array arr[] of size N and Q queries of the form [L, R], the task is to find the number of distinct values… Read More »

- Count number of increasing sub-sequences : O(NlogN)
- Queries for elements having values within the range A to B in the given index range using Segment Tree
- Dynamic Segment Trees : Online Queries for Range Sum with Point Updates
- Sum and Maximum of elements in array from [L, R] before and after updates
- Maximum pair sum in the given index ranges of an Array
- Build a segment tree for N-ary rooted tree
- Range Sum and Update in Array : Segment Tree using Stack
- Length of Longest Subarray with same elements in atmost K increments
- Array range queries to count the number of Fibonacci numbers with updates
- Binary Array Range Queries to find the minimum distance between two Zeros
- Range Queries for number of Armstrong numbers in an array with updates
- Count of divisors of product of an Array in range L to R for Q queries
- Array Range Queries to find the Maximum Armstrong number with updates
- Queries for the count of even digit sum elements in the given range using Segment Tree.
- Maximum of all subarrays of size K using Segment Tree
- Maximum distance between two 1s in a Binary Array in a given range
- Queries for greatest pair sum in the given index range using Segment Tree
- Find the element having maximum set bits in the given range for Q queries
- Array range queries to find the number of perfect square elements with updates
- Array Range Queries to count Powerful numbers with updates
- Range Queries to find the Element having Maximum Digit Sum
- Range Queries to count the number of even parity values with updates
- Array range queries to find the maximum Fibonacci number with updates
- Range Update Queries to XOR with 1 in a Binary Array.
- Find array sum using Bitwise OR after splitting given array in two halves after K circular shifts
- Query to check if a range is made up of consecutive elements

Given an array arr[] of size N and Q queries of the form [L, R], the task is to find the number of distinct values… Read More »

Given an array A[] of length N, where N is an even number, the task is to answer Q independent queries where each query consists… Read More »

Given an array arr[] of N integers, the task is to perform the following two queries: query(start, end): Print the number of Armstrong numbers in… Read More »

Given an array arr[] of N integers, the task is to perform the following two queries: maximum(start, end): Print the maximum Armstrong number of elements… Read More »

Given an array arr[] of N integers, the task is to perform the following two queries: query(start, end): Print the number of perfect square numbers… Read More »

Given an array arr[] and an integer K, the task is to find the maximum for each and every contiguous subarray of size K. Examples:… Read More »

Given an array arr[] of N integers and Q queries, each query having two integers L and R, the task is to find the element… Read More »

Given an array arr[] of N integers, the task is to perform the following two queries: query(L, R): Print the number of Even Parity numbers… Read More »

Given an array arr[] of N integers, the task is to perform the following two queries: maximum(start, end): Print the maximum Fibonacci number of elements… Read More »

Prerequisite: Segment Trees, Lazy Propagation in Segment Tree. Given an array arr[] of N integers. The task is to do the following operations: Change the… Read More »

Given an array arr[] containing N integers and an array Q[] representing the range [L, R], the task is to find the greatest pair sum… Read More »

Given an array of N integers, the task is to perform the following two operations on the given array: query(L, R): Print the number of… Read More »

Given an array arr[] of N elements, the task is to answer Q queries each having two integers L and R. For each query, the… Read More »

Given an array Arr of N integers and Q queries, each query having a range from L to R. Find the element having maximum digit… Read More »

Given a binary array arr[] of size N. The task is to answer Q queries which can be of any one type from below: Type… Read More »