Arnab Chakraborty has Published 4293 Articles

C++ program to find minimum possible difference of largest and smallest of crackers

Arnab Chakraborty

Arnab Chakraborty

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

327 Views

Suppose we have two numbers N and K. We want to distribute N crackers to K users. We have to find the minimum possible difference between the largest number of crackers received by a user and smallest number received by a user.So, if the input is like N = 7; ... Read More

C++ program to check the coins forms x amount of rupees or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:11:53

161 Views

Suppose we have two numbers K and X. Consider Amal has K, 500 rupee notes. We have to check whether the sums up to X rupees or not.So, if the input is like K = 2; X = 900, then the output will be True, because 2*500 = 1000 and ... Read More

C++ program to count in how many ways we can minimize cable length to connect computers

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:02:43

298 Views

Suppose we have two arrays A and B both with N elements. Consider there are N computers and N sockets. The coordinate of ith computer is A[i] and coordinate of ith socket is b[i]. These 2N coordinates are pair-wise distinct. We want to connect each computer with a socket by ... Read More

C++ program to check whether we can distribute bags so that two friends will get same amount of candies

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 07:01:58

229 Views

Suppose we have an array A with 4 elements. There are 4 bags of candies, ith bag contains A[i] amount of candies. We want to give each bags to one of our two friends. We have to check whether we can distribute these bags in such a way that each ... Read More

C++ program to count in how many ways we can paint blocks with two conditions

Arnab Chakraborty

Arnab Chakraborty

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

349 Views

Suppose we have three numbers N, M and K. Consider there are N blocks they are arranged in a row. We consider following two ways to paint them. The paints of two blocks different if and only if the blocks are painted in different colors in following two ways −For ... Read More

C++ program to find two points from two lines who are not same

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:58:04

375 Views

Suppose we have two ranges (l1, r1), (l2, r2) represents two lines on x-axis. l1 < r1 and l2 < r2. These segments may intersect, overlap or coincide with each other. We have to find two numbers a and b, such that a is in range (l1, r1) and b ... Read More

C++ program to find number in given range where each digit is distinct

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:55:49

514 Views

Suppose we have two numbers l and r. We have to find an integer x, which is in between l and r (both inclusive) and all digits in x are distinct.So, if the input is like l = 211; r = 230, then the output will be 213.StepsTo solve this, ... Read More

C++ program to construct graph with certain conditions

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:55:06

575 Views

Suppose we have two numbers N and K. Consider there is an undirected graph with N elements. N vertices satisfies the following conditions −The graph is simple and connectedVertices are numbered from 1 to NLet M be the number of edges in the graph. The edges are numbered from 1 ... Read More

C++ program to find nearest integer for which the number and its digits sum gcd is greater than 1

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:52:03

224 Views

Suppose we have a number N. Consider a function gcdSum(x) of a positive integer x which is the gcd of that integer with its sum of digits. We have to find the smallest integer x >= n, such that gcdSum(x) > 1.So, if the input is like N = 31, ... Read More

C++ program to find winner of cell coloring game

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:51:20

594 Views

Suppose we have two arrays A and B both are with N elements each. Consider Amal and Bimal are playing a game on a board whose cell numbers are numbered from 1 to N. And N-1 roads. Roads are connecting two cells. So ith road is connecting A[i] to B[i]. ... Read More

Advertisements