Arnab Chakraborty has Published 4452 Articles

C++ program to find out the number of iterations needed to convert all cells to black

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 10:07:48

170 Views

Suppose, we are given a grid that contains two types of cells; black cells, and white cells. The black cells are represented as '#' and the white cells are represented as '.'. The grid is given to us in an array of strings. Now, we have to perform the following.We ... Read More

C++ program to find out the center coordinates and the height of a building

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 09:58:24

200 Views

Suppose, there is a building that has center coordinates xc, yc, and height h. We don't know the center coordinates of the building, but we are provided with n pieces of information that contain x and y coordinates and an altitude value a. The altitude of coordinates (x, y) is ... Read More

C++ program to find out the maximum possible tally from given integers

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 09:47:19

253 Views

Suppose, we are given two integers n and m and there are k tuples of integers that contain four integer numbers {ai, bi, ci, di}. Four arrays a, b, c, d are given, and a[i] signifies the i-th tuple's a value. Now, let us consider a sequence dp that has ... Read More

C++ program to find out the minimum amount of time needed to reach from source to destination station by train

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 09:43:38

338 Views

Suppose n stations are connected by m tracks. The stations are named from 1 to n. The tracks are bidirectional, and we have to reach station dest from station src. Thes source and destination stations of the i-th railroad is given in the array 'roads' where roads[i] is of the ... Read More

C++ program to find out the maximum number of cells that can be illuminated

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 09:38:22

146 Views

Suppose, we are given a grid of dimensions h * w. The cells in the grid can contain either a bulb or obstacles. A light bulb cell illuminates the cells in its right, left, up, and down and the light can shine through the cells unless an obstacle cell blocks ... Read More

C++ Program to find out the number of illuminated cells in a grid

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 08:12:53

132 Views

Suppose, we are given a grid of dimensions h * w. The cells in the grid can contain either bulbs or obstacles. A light bulb cell illuminates itself and the cells in its right, left, up, and down and the light can shine through the cells unless an obstacle cell ... Read More

C++ Program to find out the number of bridge edges in a given graph

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 08:05:16

319 Views

Suppose, we are given an unweighted, undirected graph that contains n vertices and m edges. A bridge edge in a graph is an edge whose removal causes the graph to be disconnected. We have to find out the number of such graphs in a given graph. The graph does not ... Read More

C++ program to find out the number of pairs in an array that satisfy a given condition

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 07:50:50

2K+ Views

Suppose, we are given n numbers in array nums. We have to choose a pair of two numbers from the array, and there is a condition that the difference of their positions in the array is equal to the sum of the two numbers. There can be a total of ... Read More

C++ Program to check if given numbers are coprime or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 07:47:17

2K+ Views

Suppose, we have n integers in an array nums. We have to find out if the numbers in the array are pairwise coprime, setwise coprime, or not coprime.Two numbers nums[i] and nums[j] are said to be pairwise coprime if gcd(nums[i], nums[j]) = 1. This should hold for every number pair ... Read More

C++ Program to check if two stacks of letters can be emptied or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 02-Mar-2022 07:41:49

103 Views

Suppose, there are 2n number of letters and each of them has an integer number between 1 to n written on them. There are exactly two letters that have the same number written on them. These letters are arranged into m stacks and stack i has letters stack[i] on it. ... Read More

Advertisements