Ayush Gupta has Published 530 Articles

Maximums from array when the maximum decrements after every access in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:33:33

91 Views

In this problem, we are given an array arr[]and an integer M. Our task is to create a program to find Maximums from array when the maximum decrements after every access in C++.Problem DescriptionTo find the maximum, we will find the maximum element from the array and after every retrieval ... Read More

Queries for counts of multiples in an array in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:30:02

368 Views

In this problem, we are given an arr[] and Q queries each consisting of a value m. Our task is to create a program to solve the Queries for counts of multiples in an array in C++.Problem DescriptionFor solving the queries, we need to count all the numbers that are ... Read More

Queries for counts of array elements with values in given range in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:21:35

649 Views

In this problem, we are given an array arr[] and Q queries, each can be one of the two types, {1, L, R}− For the count of array elements in the range [L, R].{2, index, val}− For updating the element at index with val.Our task is to create a program ... Read More

Find distance between two nodes of a Binary Tree in C++ Program

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:14:45

285 Views

In this problem, we are given a binary tree and two nodes. Our task is to create a program to Find distance between two nodes of a Binary Tree.Problem DescriptionWe need to find the distance between two nodes which is the minimum number of edges that will be traversed when ... Read More

Queries to answer the X-th smallest sub-string lexicographically in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:13:05

179 Views

In this problem, we are given a string str and Q queries. Each Query has a number X. Our task is to create a program to solve the Queries to answer the X-th smallest sub-string lexicographically in C++.Problem DescriptionWe need to find the Xth lexicographically smallest substring for each query ... Read More

Queries to check if a number lies in N ranges of L-R in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:11:02

520 Views

In this problem, we are given N ranges [L, R] and Q queries each containing a number val. Our task is to create a program to solve Queries to check if a number lies in N ranges of L-R in C++.Problem DescriptionWe are given N ranges of type of [L, ... Read More

Queries to check whether a given digit is present in the given Range in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:09:14

346 Views

In this problem, we have given an array arr[] and some queries each consisting of three values, L and R, and val. Our task is to create a program to solve Queries to check whether a given digit is present in the given Range in C++.Problem Description−To solve each query, ... Read More

Queries to count the number of unordered co-prime pairs from 1 to N in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:04:59

278 Views

In this problem, we are given Q queries each contains a number N. Our task is to create a program to solve Queries to count the number of unordered coprime pairs from 1 to N in C++.Co-prime also known as relatively prime or mutually prime are the pair of numbers ... Read More

Queries to find distance between two nodes of a Binary tree – O(logn) method in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 09:03:23

172 Views

In this problem, we are given a binary tree and we are given Q queries. Our task is to create a program to solve Queries to find distance between two nodes of a Binary tree – O(logn) method in C++.Problem DescriptionIn each query, we are given two nodes of the ... Read More

Queries to find maximum product pair in range with updates in C++

Ayush Gupta

Ayush Gupta

Updated on 09-Oct-2020 08:58:39

383 Views

In this problem, we are given an array arr[] and Q queries. Each Query can be one of 2 types, 1st to find the maximum pair product in a given range [ Start - End ]. 2nd to update the ith index element with value. Our task is to create ... Read More

Advertisements