Arnab Chakraborty has Published 4293 Articles

Find the mean vector of a Matrix in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 12:05:50

188 Views

Suppose we have a matrix of order M x N, we have to find the mean vector of the given matrix. So if the matrix is like −123456789Then the mean vector is [4, 5, 6] As the mean of each column is (1 + 4 + 7)/3 = 4, (2 ... Read More

Find the maximum element in an array which is first increasing and then decreasing in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 12:02:44

354 Views

Suppose we have one array, which is initially increasing then decreasing. We have to find the max value in the array. So if the array elements are like A = [8, 10, 20, 80, 100, 250, 450, 100, 3, 2, 1], then output will be 500.We can use the binary ... Read More

Find the first circular tour that visits all petrol pumps in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 12:00:34

221 Views

Suppose there is a circle, and there are n petrol pumps on the circle. We have two sets of data like −The amount of petrol that every petrol pump hasDistance from one petrol pump to anotherCalculate the first point, from where a truck will be able to complete the circle. ... Read More

Find the final radiations of each Radiated Stations in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 11:57:08

150 Views

Suppose there are N stations in the straight line. Each of them has same non-negative power of radiation power. Every station can increase the radiation power of its neighboring stations in the following way.Suppose the station i with radiation power R, will increase (i – 1)th station’s radiation power, by ... Read More

Find the count of maximum contiguous Even numbers in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 11:37:01

351 Views

Suppose we have an array A with n elements. We have to find the maximum number of the contiguous even numbers in the given array. So if the array is like A = [1, 2, 3, 4, 6, 8, 7], then the count will be 3.We can solve this easily. ... Read More

Find the area of largest circle inscribed in ellipse in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 11:23:47

170 Views

Suppose we have an ellipse, with major and minor axis length 2a & 2b. We have to find the area of the largest circle that can be inscribed in it. So if the a = 5 and b = 3, then area will be 28.2734From the we can see that ... Read More

Find sum of all nodes of the given perfect binary tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 11:21:48

222 Views

Suppose we have a positive integer L, which represents the number of levels in a perfect binary tree. The leaf nodes in this perfect binary tree are numbered starting from 1 to n. Where the n is number of leaf nodes. The parent node is the sum of children. Our ... Read More

Find relative complement of two sorted arrays in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 11:16:34

454 Views

Suppose we have two sorted arrays arr1 and arr2, there sizes are m and n respectively. We have to find relative complement of two arrays. It means that we need to find all those elements which are present in arr1, but not in arr2. So if the arrays are like ... Read More

Find profession in a special family in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 11:14:18

196 Views

Consider there is a special family of doctors and engineers. There are some rules, these are like below −Everybody has two childrenFirst child of an engineer is an engineer, second child is doctorFirst child of a doctor is a doctor, second child is an engineerAll generations of doctors and engineers ... Read More

Find minimum number of currency notes and values that sum to given amount in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Dec-2019 11:11:27

2K+ Views

Suppose we have such amount, and we have to find the minimum number of notes of different denominations, that sum up to the given amount. Start from highest denomination notes, try to find as many notes possible for given amount. Here the assumption is that we have infinite amount of ... Read More

Advertisements