Skip to content

Tag Archives: Segment-Tree

Given an array arr[] of N integers, the task is to perform the following two queries:   query(start, end): Print the number of fibonacci numbers in… Read More
Given an array arr of size N and Q queries of the form [L, R], the task is to find the number of divisors of… Read More
Prerequisites: Segment TreeGiven a number N which represents the size of the array initialized to 0 and Q queries to process where there are two… Read More
Prerequisite: Segment TreesGiven a binary array arr[] consisting of only 0’s and 1’s and a 2D array Q[][] consisting of K queries, the task is… Read More
Given an array arr containing N positive integers and the number of queries Q, for each query task is to find the maximum pair sum… Read More
Given a binary array of size N and a range in [l, r], the task is to find the maximum distance between two 1s in… Read More
Given an array arr[] of N integers. The task is to do the following operations:   Add a value X to all the element from index… Read More
Prerequisite: Segment tree and depth first search.In this article, an approach to convert an N-ary rooted tree( a tree with more than 2 children) into… Read More
Given an integer array arr and a number K, the task is to find the length of the longest subarray such that all the elements… Read More
Given an array of n non-consecutive integers and Q queries, the task is to check whether for the given range l and r, the elements… Read More
Given an array arr[] of length N, the task is to find the number of strictly increasing sub-sequences in the given array. Examples:   Input: arr[]… Read More
Given an array arr[] of size N and the task is to answer Q queries of the following types: 1 X 0: Append X at… Read More
Given an array arr[] of N elements and a number of queries where each query will contain three integers L, R, and K. For each… Read More
Given an array of size N containing numbers only from 0 to 63, and you are asked Q queries regarding it.Queries are as follows:   1… Read More
Given an array of integers, the task is to calculate the sum of GCD of all the subarrays of an array. GCD of an array… Read More

Start Your Coding Journey Now!