Skip to content

Tag Archives: Segment-Tree

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
Given an array arr[], the task is to find the count of sub-arrays with GCD equal to 1.Examples:   Input: arr[] = {1, 1, 1} Output: 6 Every… Read More
Given an array arr[], the task is to find the smallest sub-arrays with GCD equal to 1. If there is no such sub-array then print… Read More
Given an array arr[] of N integers and Q queries where each query consists of an index range [L, R]. For each query, the task… Read More
Given a string S of length N, and M queries of the following type: Type 1: 1 L x, Indicates update Lth index of string S… Read More
Given an array arr[] of N integers and Q queries. Each query can be represented by two integers L and R. The task is to… Read More
Given an array arr of size N. The task is to find the kth smallest element in the subarray(l to r, both inclusive).  Note : â€¦ Read More
Given an array of size N. There can be multiple queries of the following types.   update(l, r) : On update, flip( multiply a[i] by -1)… Read More
Given an in-order traversal of a cartesian tree, the task is to build the entire tree from it. Examples:  Input: arr[] = {1, 5, 3}… Read More
Given an array arr[] of length N, the task is to find the sum of the maximum elements of every possible sub-array of the array.Examples:  â€¦ Read More
Given an array of size N, initially consists of zeroes only. The task is to apply the given operation q times and find the number… Read More
Given a binary array arr[] and q queries of following types:   k: find the index of the kth set bit i.e. kth 1 in the… Read More
Given an array arr[] of N integers and queries Q. Queries are of two types:  Update a given index ind by X. Find the gcd… Read More

Start Your Coding Journey Now!