Arnab Chakraborty has Published 4293 Articles

Find four missing numbers in an array containing elements from 1 to N in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:21:54

218 Views

Suppose we have an array of distinct numbers where each number lies in the range [1, N], the array size is (N-4) and no single element is repeated. So, we can understand four numbers, from 1 to N, are missing in the array. We have to find these 4 missing ... Read More

Find First element in AP which is multiple of given Prime in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:13:48

94 Views

Suppose we have a first term (A) and common difference (d) of an AP series, and we also have a prime number P, we have to find the position of the first element in the given AP which is the a multiple of the given prime number P.So, if the ... Read More

Find element position in given monotonic sequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:11:49

269 Views

Suppose we have a number l and a monotonic increasing sequence f(m), where f(m) = am + bm [log2(m)] + cm^3 and (a = 1, 2, 3, …), (b = 1, 2, 3, …), (c = 0, 1, 2, 3, …)Here [log2(m)] is the log to the base 2 and ... Read More

Find Duplicates of array using bit array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:09:37

189 Views

Suppose we have an array of n different numbers; n can be 32, 000 at max. The array may have duplicate entries and we do not know what is the value of n. Now if we have only 4-Kilobytes of memory, how would display all duplicates in the array?So, if ... Read More

Find distinct elements common to all rows of a matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:07:56

308 Views

Suppose we have a square matrix of order m x m; we have to find all the distinct elements common to all rows of the given matrix.So, if the input is like13215417153243615215412152643221942215then the output will be [2, 4, 15]To solve this, we will follow these steps −Define a function sortRows() ... Read More

Find d to maximize the number of zeros in array c[] created as c[i] = d*a[i] + b[i] in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:04:02

239 Views

Suppose we have two arrays A and B of n integers, now consider an array C, where the i-th number will be d*A[i] + B[i] and here d is any arbitrary real number. We have to find d such that array C has maximum number of zeros. Also return the ... Read More

Find combined mean and variance of two series in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:01:19

833 Views

Suppose we have two different series A1 and A2 of size b and a respectively. We have to find the mean and variance of combined series.So, if the input is like A1 = [24, 46, 35, 79, 13, 77, 35] and A2 = [66, 68, 35, 24, 46], then the ... Read More

Find the minimum sum of distance to A and B from any integer point in a ring of size N in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:40:14

141 Views

Suppose we have a ring, which is made of few numbers from 1 to N. We also have tow numbers A and B. Now, we can stand at any place (say x) and perform the count operation with respect of the total sum of the distance (say Z = distance ... Read More

Find the minimum positive integer such that it is divisible by A and sum of its digits is equal to B in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:37:36

269 Views

Suppose we have two numbers A and B, we have to find the minimum positive number M so that M is divisible by A and the sum of the digits of M is same as B. So, if there is no such result, then return -1.So, if the input is ... Read More

Find the minimum of maximum length of a jump required to reach the last island in exactly k jumps in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:33:21

204 Views

Suppose we have an array A of numbers, in A the i-th number is the position where an island is present, and another integer k is given (1 ≤ k < N). Now, a person is standing on the 0-th island and has to reach the last island, by jumping ... Read More

Advertisements