Arnab Chakraborty has Published 3734 Articles

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

325 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

241 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

Find the minimum number of rectangles left after inserting one into another in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:28:52

272 Views

Suppose we have width and height of N different rectangles; we have to find the minimum number of rectangles left after inserting one into another. So, if W1 and W2 be the width of rectangles R1 and R2 respectively. And H1 and H2 be the height of R1 and R2 ... Read More

Find the minimum number of moves needed to move from one cell of matrix to another in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:23:08

418 Views

Suppose we have one N X N matrix M, and this is filled with 1, 0, 2, 3, We have to find the minimum numbers of moves required to move from source cell to destination cell. While visiting through blank cells only, we can visit up, down, right and left.Cell ... Read More

Find the minimum number of preprocess moves required to make two strings equal in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:15:59

323 Views

Suppose we have two strings P and Q of same lengths with only lower case letters, we have to count the minimum number of pre-processing moves on string P are needed to make it equal to string Q after applying below operations −Select any index i and swap characters pi ... Read More

Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:03:50

466 Views

Suppose we have a given unsorted array A[0..n-1] of size n, we have to find the minimum length subarray A[s..e] so that by sorting this subarray the whole array will be sorted. So, if the array is like [2, 6, 4, 8, 10, 9, 15], then the output will be ... Read More

Find the minimum difference between Shifted tables of two numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 08:02:29

194 Views

Suppose we have two numbers p and q, we have to find the minimum difference between any terms in the shifted infinite tables of p and q, these shifts are r and s, where r, s >= 0.So, if the input is like p = 7 and q = 17, ... Read More

Find the minimum and maximum amount to buy all N candies in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 07:59:39

1K+ Views

Suppose there is a candy store where N different types of candies are available and the prices of all N different types of candies are given. The store also provides an attractive offer. According to this offer, we can buy a single candy from the store and get maximum of ... Read More

Find the maximum repeating number in O(n) time and O(1) extra space in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 07:58:19

647 Views

Suppose we have an array of size n, if the elements in the array, are in range from 0 to k-1. Where k is denoted as a positive integer and k max_val, thenmax_val := A[i]result := ireturn resultExample Let us see the following implementation to get better understanding − Live Demodef ... Read More

Find the maximum number of composite summands of a number in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2020 07:56:44

304 Views

Suppose we have a given number N that in range (1= j and table[i - j] != -1):             table[i] = max(table[i], table[i - j] + 1)    return table def max_summ(table, n):    if (n < max_val):       return table[n]    else: ... Read More

Advertisements