Arnab Chakraborty has Published 4452 Articles

C++ code to count number of times stones can be given

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 12:35:34

158 Views

Suppose we have a number n. Amal gives some stones to Bimal and he gives stones more than once, but in one move if Amal gives k stones, in the next move he cannot give k stones, so given stones in one move must be different than the previous move. ... Read More

C++ code to find how long person will alive between presses

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 12:33:35

74 Views

Suppose we have four numbers d, L, v1 and v2. Two presses are initially at location 0 and L, they are moving towards each other with speed v1 and v2 each. The width of a person is d, he dies if the gap between two presses is less than d. ... Read More

C++ code to find minimum jump to reach home by frog

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 12:30:48

328 Views

Suppose we have one binary string S with n bits and another number d. On a number line, a frog wants to reach point n, starting from the point 1. The frog can jump to the right at a distance not more than d. For each point from 1 to ... Read More

C++ code to count maximum groups can be made

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 12:27:18

343 Views

Suppose we have an array A with n elements. There were n groups of students. A group is either one person who can write the code with anyone else, or two people who want to write the code in the same team. But the mentor decided to form teams of ... Read More

C++ code to count days to complete reading book

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 12:18:41

229 Views

Suppose we have an array A with n elements and have another value t. On ith day Amal spends A[i] seconds in work. In the free time he reads a book. The entire book will take t seconds to complete. We have to find how many days he will need ... Read More

C++ code to find palindrome string whose substring is S

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 12:01:05

196 Views

Suppose we have a string S with n letters. We have to find another string T, such that T is palindrome and S is subsequence of T.So, if the input is like S = "ab", then the output will be "aabaa" (other answers are also available)StepsTo solve this, we will ... Read More

C++ code to find reduced direction string of robot movement

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 11:59:08

175 Views

Suppose we have a string S with n letters. The letters are either 'R' or 'U'. On a 2D plane, a robot can go right or up. When it is 'R' it moves right and when it is 'U' it moves up. However the string is too large, we want ... Read More

C++ code to get shortest distance from circular stations

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 11:56:52

332 Views

Suppose we have two numbers s and t, and another array D with n elements. The circle line of the Dreamland subway has n different stations. We know the distances between all pairs of neighboring stations: D[i] is the distance between station i and i+1, and D[n-1] is the distance ... Read More

C++ code to check given flag is stripped or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 11:53:56

230 Views

Suppose we have a matrix of size n x m. Each cell will hold one value from 0 to 9. There is a flag should be striped: each horizontal row of the flag should contain squares of the same color, and the colors of the adjacent horizontal rows should be ... Read More

C++ code to find minimum correct string from given binary string

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 11:49:30

93 Views

Suppose we have a binary string S with n bits. There are no redundant leading zeroes. We can perform two different operations on S −Swap any pair of adjacent bitsReplace all "11" with "1"Let val(S) is decimal representation of S. We have to find minimum correct string, where correct string ... Read More

Advertisements