Arnab Chakraborty has Published 4452 Articles

C++ program to find sequence of indices of the team members

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:27:04

124 Views

Suppose we have an array A with n elements and a number k. There are n students in a class. The rating of ith student is A[i]. We have to form a team with k students such that rating of all team members are distinct. If not possible return "Impossible", ... Read More

C++ program to count minimum number of operations needed to make number n to 1

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:20:34

280 Views

Suppose we have a number n. We perform any one of these operations arbitrary number of times −Replace n with n/2 when n is divisible by 2Replace n with 2n/3 when n is divisible by 3Replace n with 4n/5 when n is divisible by 5We have to count minimum number ... Read More

C++ program to find reduced size of the array after removal operations

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:13:13

110 Views

Suppose we have an array A with n elements. Consider there is a password with n positive integers. We apply the following operations on the array. The operations is to remove two adjacent elements that are not same as each other, then put their sum at that location. So this ... Read More

C++ program to find minimum how many operations needed to make number 0

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:09:06

199 Views

Suppose we have a numeric string S with n digits. Consider S represents a digital clock and whole string shows an integer from 0 to 10^n - 1. If there are a smaller number of digits, it will show leading 0s. Follow the operations −Decrease the number on clock by ... Read More

C++ program to find array after inserting new elements where any two elements difference is in array

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:05:15

106 Views

Suppose we have an array A with n distinct elements. An array B is called nice if for any two distinct elements B[i] and B[j], the |B[i] - B[j]| appears in B at least once, and all elements in B will be distinct. We have to check whether we can ... Read More

C++ program to check whether given string is bad or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 09:57:18

240 Views

Suppose we have a string S with n characters. S contains lowercase English letters and ')' characters. The string is bad, if the number of characters ')' at the end is strictly greater than the number of remaining characters. We have to check whether S is bad or not.So, if ... Read More

C++ program to find minimum difference between the sums of two subsets from first n natural numbers

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 08:12:37

121 Views

Suppose we have a number n. Consider, first n natural numbers. We have to split them into two sets A and B such that each element belongs to exactly one set and the absolute difference between the sum of elements in A and sum of elements in B is minimum, ... Read More

C++ program to count number of stairways and number of steps in each stairways

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 08:08:46

208 Views

Suppose we have an array A with n elements. Let, Amal climbs the stairs inside a multi-storey building. Every time he climbs, start counting from 1. For example, if he climbs two stairways with 3 steps and 4 steps, he will speak the numbers like 1, 2, 3, 1, 2, ... Read More

C++ program to find indices of soldiers who can form reconnaissance unit

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 08:02:06

226 Views

Suppose we have an array A with n elements. There are n soldiers standing on a circle. For ith soldier, the height is A[i]. A reconnaissance unit can be made of such two adjacent soldiers, whose heights difference is minimal. So each of them will be less noticeable with the ... Read More

C++ program to find order of loading golds on weight scale without exploding it

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:58:45

89 Views

Suppose we have an array A with n distinct elements, and another number x. There are n pieces of gold. The ith gold weight is A[i]. We will put this n pieces on weight scale one piece at a time. But the scale has an unusual defect: if the total ... Read More

Advertisements