Arnab Chakraborty has Published 4293 Articles

C++ program to find winner of ball removal game

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 09:54:30

279 Views

Suppose we have four numbers n1, n2, k1 and k2. Consider there are 2 boxes, first one has n1 balls and second one has n2 balls. Amal and Bimal are playing the game. In one move they can take from 1 to k1 balls and throw them out, similarly second ... Read More

C++ program to find minimum how much rupees we have to pay to buy exactly n liters of water

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 07:12:40

222 Views

Suppose we have three numbers n, a and b. We want to buy n liters of water. There are only two types of water bottles nearby, 1-liter bottles and 2-liter bottles. The bottle of the first type a rupees and the bottle of the second type costs b rupees. We ... Read More

C++ Program to find minimum possible ugliness we can achieve of towers

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 07:09:47

193 Views

Suppose we have an array A with n elements. Consider there are n block towers in a row. The ith tower has height A[i]. In a single day, we can perform the operation: Select two indices i and j (i != j) and move back from tower i to j. ... Read More

C++ Program to find room status after checking guest appearance record

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 07:06:54

333 Views

Suppose we have a string S with 'L', 'R' and digits from 0 to 9. Consider there is a hotel with 10 rooms they are numbered from 0 to 9, from left to right. The hotel has two entrances-one from the left side, and another from the right side. When ... Read More

C++ Program to find winner name of stick crossing game

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 06:46:42

264 Views

Suppose we have two numbers n and k. Amal and Bimal are playing a game. The rules are simple. Amal draws n sticks in a row. After that the players take turns crossing out exactly k sticks from left or right in each turn. Amal starts the game. If there ... Read More

C++ Program to count number of operations needed to place elements whose index is smaller than value

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 06:41:57

265 Views

Suppose we have an array A with n elements. We can perform these operations any number of times −Select any positive integer kSelect any position in the sequence and insert k into that positionSo, the sequence is changed, we proceed with this sequence in the next operation.We have to find ... Read More

C++ program to find length of non empty substring whose sum is even

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 06:38:37

135 Views

Suppose we have an array A with n elements. We have to find the length of a non-empty subset of its elements such that their sum is even or return -1 when there is no such subset.So, if the input is like A = [1, 3, 7], then the output ... Read More

C++ program to find string with palindrome substring whose length is at most k

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 06:29:01

285 Views

Suppose we have two numbers n and k. Let we are trying to generate a string S with only three types of characters 'a', 'b' and 'c'. The maximum length of a substring of the string S that is a palindrome which does not exceeds k.So, if the input is ... Read More

C++ Program to count number of characters to be removed to get good string

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-Mar-2022 06:23:53

237 Views

Suppose we have a string S. S contains two types of characters in S, the 'x' and 'a'. We have to count what will be the longest string remaining after removal of few characters in S so that it becomes good string. A string is good if it has strictly ... Read More

C++ program to count minimum how many minutes after there will be no new angry students

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 11:37:58

197 Views

Suppose we have a string S of length n, with only two types of characters, 'A' or 'P'. There are n students in a row, the ith student is angry if S[i] = 'A', if it is 'P' it says S[i] is patient. An angry student at index i will ... Read More

Advertisements