Arnab Chakraborty has Published 4293 Articles

Find GCD of factorial of elements of given array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:39:53

406 Views

Suppose we have an array A, with N elements. We have to find the GCD of factorials of all elements of the array. Suppose the elements are {3, 4, 8, 6}, then the GCD of factorials is 6. Here we will see the trick. As the GCD of two numbers, ... Read More

Minimum positive integer divisible by C and is not in range [A, B] in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:36:23

122 Views

Suppose we have three integers A, B, and C. We have to find one minimum integer X, such that X mod C = 0, and X is not in the range [A, B]. If the values of A, B and C are 5, 10 and 4 respectively, then the value ... Read More

Minimum operations to make GCD of array a multiple of k in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:33:39

154 Views

Suppose we have an array arr and another value k. We have to find a minimum number of operations to make the GCD of the array equal to the multiple of k. In this case, the operation is increasing or decreasing the value. Suppose the array is like {4, 5, ... Read More

Minimum Number of Manipulations required to make two Strings Anagram Without Deletion of Character in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:28:24

473 Views

Suppose we have two strings of equal length, we have to find a minimum number of alterations required to make two strings anagram, without deleting any character. The Anagram is two strings that have the same set of characters. Suppose two strings are “HELLO”, and “WORLD” here number of required ... Read More

Minimum LCM and GCD possible among all possible sub-arrays in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:22:14

269 Views

Suppose we have an array arr of size N. it has N positive numbers. We have to find the minimum elements of all possible subarray. Suppose the array is {2, 66, 14, 521}, then minimum LCM is 2, and GCD is 1.We will solve this problem using a greedy approach. ... Read More

Minimize Cost with Replacement with other allowed in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:19:38

225 Views

Suppose we have an array with N elements. We have to remove element from the array by following the given operations. The operation is like, we have to choose any two numbers of the array, and remove larger. Cost including in this operation is the same as the smaller number. ... Read More

Meta Strings (Check if two strings can become same after a swap in one string) in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:17:11

680 Views

In this section, we will see how to check whether two strings are meta string or not. The meta strings are those strings that are very much similar. If we swap two elements in one string, then it will be matched with other string. Suppose two strings are “HELLO” and ... Read More

Maximum Subarray Sum using Divide and Conquer algorithm in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:14:08

1K+ Views

Suppose we have one list of data with positive and negative values. We have to find the sum of contiguous subarray whose sum is largest. Suppose the list is containing {-2, -5, 6, -2, -3, 1, 5, -6}, then the sum of maximum subarray is 7. It is the sum ... Read More

Maximum positive integer divisible by C and is in the range [A, B] in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:10:26

153 Views

Here we will see one interesting problem. let us consider we have three integers A, B, and C. We have to find one minimum integer X, such that X mod C = 0, and X is not in the range [A, B]. If the values of A, B and C ... Read More

Maximum length subarray with LCM equal to product in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:07:31

364 Views

Suppose we have an array A. We have to find the maximum length of the subarray, whose LCM is the same as the product of the elements of that subarray. If that kind of subarray is not found, then return -1. Suppose array is {6, 10, 21}, then the length ... Read More

Advertisements