Arnab Chakraborty has Published 3734 Articles

Find nth term of the Dragon Curve Sequence in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 08:04:02

292 Views

Here we will see a program, that can find nth term of the Dragon Curve sequence. The Dragon curve sequence is an infinite binary sequence. It starts with 1, and in each step, it alternatively adds 1s and 0s before and after each element of the previous term, to form ... Read More

Find LCM of rational number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:59:16

205 Views

Here we will see how to find the LCM of Rational numbers. We have a list of rational numbers. Suppose the list is like {2/7, 3/14, 5/3}, then the LCM will be 30/1.To solve this problem, we have to calculate LCM of all numerators, then gcd of all denominators, then ... Read More

Find if nCr is divisible by the given prime in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:52:50

231 Views

Suppose there are three variables N, R and P. The N and R are used to get the NCR and P is a prime. We have to find whether NCR is divisible by P. Suppose we have some numbers N = 7, R = 2 and P = 3, then ... Read More

Find if a point lies inside a Circle in C++

Arnab Chakraborty

Arnab Chakraborty

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

3K+ Views

Suppose, one circle is given (the center coordinate and radius), another point is also given. We have to find whether the point is inside the circle or not. To solve it, we have to find the distance of the given point from circle center. If that distance is less or ... Read More

Find HCF of two numbers without using recursion or Euclidean algorithm in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2019 07:43:18

814 Views

As we know, the HCF or GCD can be calculated easily using the Euclidean Algorithm. But here we will see how to generate GCD or HCF without using the Euclidean Algorithm, or any recursive algorithm. Suppose two numbers are present as 16 and 24. The GCD of these two is ... Read More

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

Arnab Chakraborty

Arnab Chakraborty

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

448 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

152 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

184 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

514 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

320 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

Advertisements