Given a binary array arr[] of size N and a 2D array Q[][] containing K queries of the following two types: 1 : Print the… Read More
Tag Archives: Segment-Tree
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
Given an array arr[] consisting of integers and queries Q of the form (L, R), the task is to check whether any non-repeating element is… Read More
Given a number in form of string str and an integer K, the task is to find the smallest integer that can be formed after… Read More
Given an array arr[] of size N and Q queries of the form [L, R], the task is to find the number of distinct values… Read More
Given an array A[] of length N, where N is an even number, the task is to answer Q independent queries where each query consists… Read More