Arnab Chakraborty has Published 4293 Articles

Find a pair with maximum product in array of Integers in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 12:50:20

194 Views

Consider we have an array A, there are n different elements. We have to find a pair (x, y) from the array A, such that the product of x and y is maximum. The array may contain positive or negative elements. Suppose an array is like: A = [-1, -4, ... Read More

Find a pair of elements swapping which makes sum of two arrays same in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 12:44:48

401 Views

Consider we have two arrays with different number of elements. We have to find a pair of elements (x, y), where x is present in the first array, and y is present at the second array. The pair will be chosen such that after swapping the elements between these two ... Read More

Find a number x such that sum of x and its digits is equal to given n in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 12:40:45

343 Views

Here we will see one problem, where we take a number n, we have to find another value say x, such that x + digit sum of x is same as the given number n. Suppose the value of n is 21. This program will return a number x = ... Read More

Find a Fixed Point in an array with duplicates allowed in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 12:37:06

181 Views

Here we will see how to find fixed point in a given array. In array one element will be denoted as fixed point if the value is same as its index. This program will return the value if any, otherwise return -1. The array can hold negative numbers also. And ... Read More

Find a Fixed Point (Value equal to index) in a given array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 12:34:24

250 Views

Here we will see how to find fixed point in a given array. In array one element will be denoted as fixed point if the value is same as its index. This program will return the value if any, otherwise return -1. The array can hold negative numbers also. And ... Read More

Find a distinct pair (x, y) in given range such that x divides y in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 12:31:50

136 Views

Here we will see one interesting problem, we will find a pair (x, y), where x and y are in range so l

Final cell position in the matrix in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 12:29:04

201 Views

Suppose we have a set of commands as a string, the string will have four different letters for four directions. U for up, D for down, L for left and R for right. We also have initial cell position (x, y). Find the final cell position of the object in ... Read More

Fill missing entries of a magic square in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 24-Oct-2019 11:53:22

227 Views

Suppose we have one 3x3 matrix, whose diagonal elements are empty at first. We have to fill the diagonal such that the sum of row, column and the diagonal will be same. Suppose a matrix is like −036505470After filling, it will be −636555474Suppose the diagonal elements are x, y, z. ... Read More

Minimum and Maximum number of pairs in m teams of n people in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2019 09:15:43

300 Views

Problem statementN participants of the competition were split into M teams in some manner so that each team has at least one participant. After the competition each pair of participants from the same team became friends.Your task is to write a program that will find the minimum and the maximum ... Read More

Minimizing array sum by applying XOR operation on all elements of the array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2019 09:11:59

226 Views

DescriptionGiven an array of size, N. Find an element X such that the sum of array elements should be minimum when XOR operation is performed with X and each element of an array.If input array is: arr [] = {8, 5, 7, 6, 9} then minimum sum will be 30 ... Read More

Advertisements