Given an array arr[] consisting of N positive integers and an array Query[][2] consisting of Q queries of the form {L, R}, the task is… Read More

# Tag Archives: Segment-Tree

Given a string S of length N and a 2D array of strings Q[][] consisting of M queries of the following type: Query(“U”, “I”, “X”):… Read More

Given an array arr[] consisting of N integers, an integer X, and a 2D array queries[][] consisting of queries of the following two types: (L,… Read More

Given an array arr[] consisting of N integers and a 2D array Q[][] consisting of queries of the following two types: 1 L R: Print… Read More

Given an array arr[] consisting of N 0s and a 2D array Q[][] consisting of queries of the following two types: 1 L R X:… Read More

Given an array arr[] of size N and a 2D array Q[][] consisting of queries of following two types: 1 X Y: Update the array… Read More

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