Arnab Chakraborty has Published 4452 Articles

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

153 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

258 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

232 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

421 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

448 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

153 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

429 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

C++ program to find in how many bases we can represent the number not greater than M

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:48:09

109 Views

Suppose we have a numeric string S, and another number M. Let d be the greatest digit in S. We have to find in many different integers not greater than M can be found by choosing an integer n not less than d+1 and seeing S as a base-n number?So, ... Read More

C++ program to count final number of characters are there after typing n characters in a crazy writer

Arnab Chakraborty

Arnab Chakraborty

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

80 Views

Suppose we have an array A with n elements, and another value c is there. There is a crazy word processor present in our system where we can type characters but if we do not type for consecutive c seconds, all of the written letters will be removed. A[i] represents ... Read More

C++ program to find longest possible time not greater than T to solve all problems

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 06:44:35

169 Views

Suppose we have an array A with N elements. Have another number T. Consider Amal is trying to participate in a programming contest. It lasts for T minutes and present N problems. He has A[i] time to solve ith problem. He will choose zero or more problems to solve from ... Read More

Advertisements