Arnab Chakraborty has Published 3734 Articles

Minimize (max(A[i], B[j], C[k]) – min(A[i], B[j], C[k])) of three different sorted arrays in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:24:04

318 Views

Suppose we have three sorted arrays A, B, and C (these can be of different sizes), we have to find compute the minimum absolute difference between the maximum and minimum number of any triplet (A[i], B[j], C[k]) such that they are under arrays A, B and C respectively, So, if ... Read More

Find the sum of maximum difference possible from all subset of a given array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:21:07

471 Views

Suppose we have an array A of n values (elements may not be distinct). We have to find the sum of maximum difference possible from all subsets of given array. Now consider max(s) denotes the maximum value in any subset, and min(s) denotes the minimum value in the set. We ... Read More

Find the sum of all Truncatable primes below N in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:18:47

341 Views

Suppose we have a given integer N; we have to find the sum of all Truncatable primes less than N. As we know the truncatable prime is a number which is left-truncatable prime (if the leading "left" digit is successively removed, then all resulting numbers are treated as prime) as ... Read More

Minimize (max(A[i], B[j], C[k]) – min(A[i], B[j], C[k])) of three different sorted arrays in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:17:27

583 Views

ConceptWith respect of given three sorted arrays A, B, and C of not necessarily same sizes, compute the lowest i.e. minimum absolute difference between the maximum and minimum number of any triplet A[i], B[j], C[k] such that they are under arrays A, B and C respectively, i.e., minimize (max(A[i], B[j], ... Read More

Maximum Consecutive Increasing Path Length in Binary Tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:09:46

300 Views

Suppose we have a binary tree; we have to calculate the length of the longest path which consists of nodes with consecutive values in increasing order. Every node will be treated as a path of length 1.So, if the input is likethen the output will be 3 as (11, 12, ... Read More

Find the smallest window in a string containing all characters of another string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:07:33

528 Views

Suppose we have two strings s1 and s2, we have to find the smallest substring in s1 such that all characters of s2 will be used efficiently.So, if the input is like s1 = "I am a student", s2 = "mdn", then the output will be "m a studen"To solve ... Read More

Unique element in an array where all elements occur k times except one in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:05:14

481 Views

we have an array A. A has all elements occurring m times, but one element occurs only once. We have to find that unique element.So, if the input is like A = [6, 2, 7, 2, 2, 6, 6], m = 3, then the output will be 7.To solve this, ... Read More

Find the smallest positive integer value that cannot be represented as sum of any subset of a given array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:04:59

673 Views

Suppose we have a sorted array of positive numbers, this array is sorted in ascending order, er have to find the smallest positive value that cannot be represented as sum of elements of any subset of given set. We have to solve this problem in O(n) time.So, if the input ... Read More

Find the shortest distance between any pair of two different good nodes in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 12:03:08

515 Views

Suppose we have a given weighted undirected graph with N different nodes and M edges, some of the nodes are good nodes. We have to find the shortest distance between any pair of two different good nodes. In the given diagram the yellow in the following graph are considered to ... Read More

Find the probability of reaching all points after N moves from point N in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 27-Aug-2020 11:58:22

180 Views

Suppose we have a number N this represents the initial position of the person on the number line. We also have L which is the probability of the person of going left. We have to find the the probability of reaching all points on the number line after completing N ... Read More

Advertisements