## 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 »

- Counting inversions in an array using segment tree
- Queries to check whether a given digit is present in the given Range
- Iterative Segment Tree (Range Minimum Query)
- Iterative Segment Tree (Range Maximum Query with Node Update)
- Range and Update Sum Queries with Factorial
- Range queries to count 1s in a subarray after flip operations
- Number of subarrays have bitwise OR >= K
- Queries to find maximum product pair in range with updates
- Queries for Composite numbers in subarray (With Point Updates)

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 »