Arnab Chakraborty has Published 4452 Articles

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

107 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

287 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

206 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

292 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

107 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

155 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

212 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

C++ program to find at least how much score it needs to get G amount of score

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:24:07

215 Views

Suppose we have two arrays p and c both are with D number of elements each, and another number G. Consider in a coding contest, each problem has its score based on difficulty. The problem p[i] has score 100i. These p[1] + ... + p[D] problems are all of the ... Read More

C++ program to count maximum possible division can be made in a graph with given condition

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 12:21:17

100 Views

Suppose we have an adjacency matrix of a graph G. We have to check whether we can divide the vertices into non-empty sets V1, ... Vk, such that: every edge connects two vertices belonging to two adjacent sets. If the answer is yes, we have to find the maximum possible ... Read More

C++ Program to find maximum possible smallest time gap between two pair of clock readings

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 11:27:24

116 Views

Suppose we have an array D with N elements. Consider in a code festival there are N+1 participants including Amal. Amal checked and found that the time gap between the local times in his city and the i-th person's city was D[i] hours. The time gap between two cities: For ... Read More

Advertisements