## Levelwise Alternating GCD and LCM of nodes in Segment Tree

A Levelwise GCD/LCM alternating segment tree is a segment tree, such that at every level the operations GCD and LCM alternate. In other words at… Read More »

- 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
- Build a segment tree for N-ary rooted tree
- Sum and Maximum of elements in array from [L, R] before and after updates
- Range Sum and Update in Array : Segment Tree using Stack
- Queries to check if any non-repeating element exists within range [L, R] of an Array
- Lexicographical smallest number after at most K consecutive swaps
- Maximum pair sum in the given index ranges of an Array
- Range Queries for number of Armstrong numbers in an array with updates
- Sum of prime numbers in range [L, R] from given Array for Q queries
- Array range queries to count the number of Fibonacci numbers with updates
- Maximum of all subarrays of size K using Segment Tree
- Binary Array Range Queries to find the minimum distance between two Zeros
- Array Range Queries to find the Maximum Armstrong number with updates
- Count of divisors of product of an Array in range L to R for Q queries
- Queries for the count of even digit sum elements in the given range using Segment Tree.
- 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
- Find array sum using Bitwise OR after splitting given array in two halves after K circular shifts
- Array range queries to find the number of perfect square elements with updates
- Maximum distance between two 1s in a Binary Array in a given range
- Array Range Queries to count Powerful numbers with updates
- Count of distinct numbers in an Array in a range for Online Queries using Merge Sort Tree
- 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.

A Levelwise GCD/LCM alternating segment tree is a segment tree, such that at every level the operations GCD and LCM alternate. In other words at… Read More »

Given an array arr[0 . . . n-1]. Find the maximum of elements from index l to r where 0 <= l <= r <=… Read More »

Given N numbers and Q queries, each query consists of L and R. Task is to write a program which prints the count of numbers… Read More »

Given a rectangular matrix M[0…n-1][0…m-1], and queries are asked to find the sum / minimum / maximum on some sub-rectangles M[a…b][e…f], as well as queries… Read More »

Euler tour tree (ETT) is a method for representing a rooted tree as a number sequence. When traversing the tree using Depth for search(DFS), insert… Read More »

Given N pieces of chessboard all being ‘white’ and a number of queries Q. There are two types of queries : Update : Given indices… Read More »

Given a string of brackets, task is to find the number of pairs of brackets involved in a balanced sequence in a given range. Examples… Read More »

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

A Levelwise OR/XOR alternating segment tree is a segment tree, such that at every level the operations OR and XOR alternate. In other words at… Read More »

Given a number N, and Q queries of two types 1 and 2. Task is to write a code for the given query where, in… Read More »

Given an array of N(always a power of 2) elements and Q queries. Every Query consists of two elements index and value.. We need to… Read More »

Given a bracket sequence or in other words a string S of length n, consisting of characters ‘(‘ and ‘)’. Find length of the maximum… Read More »

Given an array A of N integers. You have to answer two types of queries : 1. Update [l, r] – for every i in… Read More »

Given an array of n integers in non-decreasing order. Find the number of occurrences of the most frequent value within a given range. Examples: Input… Read More »

Given an array of n numbers, the task is to answer the following queries: maximumSubarraySum(start, end) : Find the maximum subarray sum in the range… Read More »