Arnab Chakraborty has Published 4282 Articles

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

423 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

369 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

204 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

276 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

160 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

215 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

255 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

338 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

260 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

Check if a pair with given product exists in Linked list in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 11:55:49

180 Views

We have a set of elements. And a product K. The task is to check whether there exist two numbers in the linked list, whose product is same as K. If there are two numbers, then print them, if there are more than two numbers, then print any of them. ... Read More

Advertisements