Arnab Chakraborty has Published 4293 Articles

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

316 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

321 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

143 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

C++ program to check xor game results 0 or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:56:00

176 Views

Suppose we have an array A with N elements and another binary string S. Consider two players are playing a game. They are numbered as 0 and 1. There is one variable x whose initial value is 0. The games has N rounds. In ith round person S[i] does one ... Read More

C++ program to concatenate strings in reverse order

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:52:29

609 Views

Suppose we have two strings S and T. Both are in lowercase letters. Concatenate T and S in this order to generate the final string.So, if the input is like S = "ramming"; T = "prog", then the output will be "programming"StepsTo solve this, we will follow these steps −res ... Read More

C++ program to count number of cities we can visit from each city with given operations

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:50:08

719 Views

Suppose we have a list of N coordinate points P in the form (xi, yi). The x and y values are permutation of first N natural numbers. For each k in range 1 to N. We are at city k. We can apply the operations arbitrarily many times. The operation: ... Read More

C++ program to count number of operations needed to reach n by paying coins

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:47:24

188 Views

Suppose we have five numbers, N, A, B, C, D. We start with a number 0 and end at N. We can change a number by certain number of coins with the following operations −Multiply the number by 2, paying A coinsMultiply the number by 3, paying B coinsMultiply the ... Read More

C++ program to find maximum distance between two rival students after x swaps

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:47:12

307 Views

Suppose we have four numbers n, x, a and b. There are n students in the row. There are two rivalling students among them. One of them is at position a and another one is at position b. Positions are numbered from 1 to n from left to right. We ... Read More

C++ program to find array after removal of left occurrences of duplicate elements

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:40:37

156 Views

Suppose we have an array A with n elements. We want to remove duplicate elements. We want to leave only the rightmost entry for each element of the array. The relative order of the remaining unique elements should not be changed.So, if the input is like A = [1, 5, ... Read More

C++ program to find maximum possible amount of allowance after playing the game

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:40:24

236 Views

Suppose we have three numbers A, B and C. Consider a game: There are three "integer panels", each with a digit form 1 to 9 (both inclusive) printed on it, and one "operator panel" with a '+' sign printed on it. The player should make a formula of the form ... Read More

Advertisements