Arnab Chakraborty has Published 4452 Articles

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

Arnab Chakraborty

Arnab Chakraborty

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

71 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

108 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

410 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

124 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

848 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

192 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

195 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

C++ Program to find out the number of jumps needed for a robot to reach a particular cell in a grid

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 10:46:30

171 Views

Suppose, we have a grid of dimensions h x w. The grid is represented in a 2D array called ‘initGrid’, where each cell in the grid is either represented by a '#' or a '.'. '#' means that the grid contains an obstacle and '.' means that there is a ... Read More

C++ Program to find out the number of unique matrices that can be generated by swapping rows and columns

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 10:31:41

120 Views

Suppose, we have a n x n matrix. Each element in the matrix is unique and is an integer number between 1 and n2. Now we can perform the operations below in any amount and any order.We pick any two integers x and y that are in the matrix, where ... Read More

C++ Program to find out the total cost required for a robot to make a trip in a grid

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Feb-2022 10:05:21

119 Views

Suppose, we are given a grid of dimensions h x w. Each cell in the grid contains some positive integer number. Now there is a path-finding robot placed on a particular cell (p, q) (where p is the row number and q is the column number of a cell) and ... Read More

Advertisements