Arnab Chakraborty has Published 4293 Articles

C++ program to check we can buy product with given money or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 13:02:27

231 Views

Suppose we have a number N. A cake seller is selling cakes with 40 rupees, and doughnuts with 70 rupees each. We have to check whether we can buy some of them with exactly N rupees or not.So, if the input is like N = 110, then the output will ... Read More

C++ Program to check we can remove all stones by selecting boxes

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 12:57:26

173 Views

Suppose we have an array A with N elements. Consider there are N boxes and they are arranged in a circle. The ith box contains A[i] stones. We have to check whether we can remove all stones from the boxes by repeatedly performing the operation: Select a box say ith ... Read More

C++ program to find last value of matrix with given constraints

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 12:51:54

153 Views

Suppose we have a list of numbers A with N elements in it. The elements are 1, 2 or 3, Consider a number X[1][j] = A[j] where j is in range 1 to N. And X[i][j] = |X[i-1][j] - X[i-1][j+1]| where i is in range 2 to N and j ... Read More

C++ Program to find minimum possible unlancedness of generated string T

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 12:36:39

153 Views

Suppose we have a string S with possible characters '0', '1' or '?'. We want to make string T by replacing each occurrence of '?' with 0 or 1. The unbalancedness of T is like: maximum of the all absolute differences between number of occurrences of 0 and 1 in ... Read More

C++ Program to find out the maximum rated parts set

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 12:28:29

155 Views

Suppose, there is a manufacturer that makes specific parts for a particular product. The manufacturer has n different variations of the parts, and the parts have a specific rating on three criteria. The ratings of the n products are given in the array 'ratings' where each element is of the ... Read More

C++ Program to find out if a round trip is possible from a particular city

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 11:53:13

533 Views

Suppose, there are n cities and m roads are connecting them. Each road is unidirectional, and it takes a particular amount of time to reach from the source city to the destination city. The information of the roads is given in the array roads where each element is of the ... Read More

C++ program to find out the maximum value of i

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 11:41:05

198 Views

Suppose, we have a permutation of integers 'seq' and an array of integer pairs 'pairs' of size m that contains integers 0 to n - 1. Now, we perform the following operation on seq as many times as possible so that seq[i] = i (0 ≤ i < n) is ... Read More

C++ program to find out the number of coordinate pairs that can be made

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 11:29:45

1K+ Views

Suppose, we are given 2n number of coordinates on a two-dimensional plane. The 2n coordinates are divided into two arrays coordA, and coordB. The coordinates are represented as integer pairs. Now we have to form coordinate pairs that will contain one point from coordA and one point from coordB. We ... Read More

C++ program to find out the maximum sum of a minimally connected graph

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 11:18:57

249 Views

Suppose, we are given a minimally connected graph. That means removing any edge will make the graph disconnected. The graph has n vertices and the edges are given in an array 'edges'. There is also an array 'vertexValues' given to us that contain n integer values.Now, we do the following ... Read More

C++ Program to find out the cost to travel all the given coordinates

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 11:07:24

263 Views

Suppose, we are given n three-dimensional coordinates. The cost to travel from coordinate (a, b, c) to (x, y, z) is ∣ x − a∣ + ∣ y − b∣ + max(0, z − c). We start from the first coordinate, then visit all the coordinates at least once, and ... Read More

Advertisements