Given an array arr[] of size N and a 2D array Q[][] consisting of queries of the following two types: 1 X Y: Update the… Read More
Tag Archives: Segment-Tree
Given two arrays A[] and B[] consisting of N integers and an integer K, the task is to find the maximum value of B[i] +… Read More
Given an array arr[] consisting of N integers and an array Queries[] consisting of Q queries of the type {X, L, R} to perform following… Read More
Given an array arr[] of size N and a 2D array Q[][], consisting of queries of the following two types: 1 X Val: Update arr[X]… Read More
Given an array arr[] of size N and an integer K, the task is to find the length of the longest subarray consisting of same… Read More
Given an array arr[] of size N, where arr[i] denotes the number of elements on the left that are greater than the ith element in… Read More
Given two arrays arr[] and query[] of sizes N and Q respectively and an integer M, the task for each query, is to count the… Read More
Given an array arr[] consisting of N integers, the task is to find the maximum sum of an array formed by decreasing array elements by… Read More
Given a string str, consisting of lowercase English alphabets, the task is to calculate the sum of indices(1-based indexing) of the characters removed to obtain… Read More
Given a string S of Size N. Initially, the value of count is 0. The task is to find the value of count after N… Read More
Given an array arr[] consisting of N integers and queries Q[][] of the form {L, R} where 0 ≤ L < R ≤ N –… Read More
Given an array A[], for each element in the array, the task is to find the sum of all the previous elements which are strictly… Read More
Given an array arr[] of the size of N followed by an array of Q queries, of the following two types: Query Type 1: Given… Read More