Skip to content

Tag Archives: GCD-LCM

There is an array with n elements. Find length of the largest subarray having GCD equal to 1. If no subarray with GCD 1, then… Read More
Given three positive integers a, b and n. Consider a list that has all multiples of ‘a’ and ‘b’. the list is  sorted and duplicates… Read More
Given an array of n elements, find out the maximum possible sum of all elements such that all the elements are equal. Only operation allowed… Read More
Given three positive integer L, R, G. The task is to find the count of the pair (x,y) having GCD(x,y) = G and x, y… Read More
Given three numbers x, y and k, find the k’th common factor of x and y. Print -1 if there are less than k common… Read More
Given three positive integer n, x, y. The task is to print Greatest Common Divisor of numbers formed by n repeating x times and number… Read More
Given two numbers x and y (x <= y), find out the total number of natural numbers, say i, for which i! is divisible by… Read More
Given a number x, the task is to find first natural number i whose factorial is divisible by x.Examples :   Input : x = 10… Read More
Given a matrix of n rows and m columns. The task is to replace each matrix element with Greatest Common Divisor of its row or… Read More
Given a positive floating point number n, the task is to find the smallest integer k, such that when we multiply k with n, we… Read More
Given two coordinates (x, y) and (a, b). Find if it is possible to reach (x, y) from (a, b).  Only possible moves from any… Read More
Given a number N, the task is to find out maximum sum of distinct numbers such that the Least Common Multiple of all these numbers… Read More
Given a number n such that 1 <= N <= 10^6, the Task is to Find the LCM of First n Natural Numbers.  Examples:  Input… Read More
Given an array arr[] such that 1 <= arr[i] <= 10^12, the task is to find prime factors of LCM of array elements. Examples:  Input… Read More
Given three integers x, y, z, the task is to compute the value of GCD(LCM(x,y), LCM(x,z)). Where, GCD = Greatest Common Divisor, LCM = Least Common… Read More

Start Your Coding Journey Now!