Arnab Chakraborty has Published 4293 Articles

C++ program to count how many minutes we have to wait to meet at least one swimmer

Arnab Chakraborty

Arnab Chakraborty

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

228 Views

Suppose we have four numbers p, a, b and c. There is a pool and three swimmers are there. They take a, b and c minutes to cross the pool and come back, respectively. So the first swimmer will be at the left side of pool after 0, a, 2a, ... Read More

C++ program to find sum of all cells lighten by the lamps

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 05:49:46

178 Views

Suppose we have a grid with H rows and W columns. Where each square is tidy or untidy. We can place lamps on zero or more more tidy squares in this grid. A lamp can lighten the cells in each of the four directions - up, down, left, and right ... Read More

C++ program to check we can rearrange array in such a way that given formula returns m or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 05:43:20

106 Views

Suppose we have an array A with n elements and another number m. We have to check whether we can rearrange the array in such a way that$$\mathrm{\sum_{i=1}^{n} \sum_{j=1}^{n}\frac{A[j]}{j} = m}$$There will be no rounding in A[j]/j operation.So, if the input is like A = [2, 5, 1]; m = ... Read More

C++ program to find largest or equal number of A whose sum of digits is divisible by 4

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 05:39:41

183 Views

Suppose we have a number A. We have to find nearest larger or equal interesting number for A. A number is said to be interesting number if its sum of digits is divisible by 4. So, if the input is like A = 432, then the output will be 435, because ... Read More

C++ Program to find out the number of sides that a polygon has inside a grid

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:55:32

480 Views

Suppose, we are given a grid of dimensions h x w. There are two types of cells in the grid, white and black cells. White cells are represented by '.', whereas black cells are represented by '#'. Now the grid has multiple black cells in it that form a polygon. ... Read More

C++ Program to find out the moves to read a point from another point in a 2D plane

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:40:34

321 Views

Suppose, there are two points in a 2D plane a and b that have the coordinates (x1, y1) and (x2, y2) respectively. Currently, we are at point 'a' and we can move at a distance of 1 either vertically or horizontally. We move to point b from point a, then ... Read More

C++ Program to find out the minimum number of operations required to defeat an enemy

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:39:00

415 Views

Suppose, we are playing a video game where the protagonist uses knives to defeat his enemies. The protagonist can use the knife for slashing the enemy or he can throw it towards the enemy. If the protagonist throws a knife, that cannot be retrieved again. The damage dealt by knife ... Read More

C++ program to find out number of changes required to get from one end to other end in a grid

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:37:34

187 Views

Suppose, we are given a grid of dimensions x * y that contains two types of cells, blocked and unblocked. Blocked cells mean that the cells aren't accessible and unblocked means that the cells are accessible. We represent the grid in a 2D array where the blocked cells are given ... Read More

C++ Program to find out the least amount of money required to subscribe to the OTT services

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:35:09

207 Views

Suppose, a telecom operator has introduced a service called "all-in-one" which provides access to n OTT content providers at a fixed price of k dollars. Now, if we have to subscribe to the OTT platforms directly, we have to pay an individual amount of fee to each of the platforms. ... Read More

C++ program to find minimum number of locations to place bombs to kill all monsters

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:26:48

317 Views

Suppose we have two arrays X and H. Both are with N elements, also have another two numbers D and A. Consider in a story, a silver fox is fighting with N monsters. The monsters are standing in a row, coordinate of ith monster is X[i], and its health is ... Read More

Advertisements