Given an integer N, the task is to find the value after performing the following N operation when i is 1 initially: Find the value… Read More

# Tag Archives: GCD-LCM

Given an array arr[] of integers N, the task is to find the GCD of all numbers for which it’s value is equal to its… Read More

Given an array arr[] of N integers and an integer K, the task is to find the GCD of all the array elements except the… Read More

Given two arrays A[] and B[] of size N and M calculate GCD of all pairwise sum of (A[i]+B[j]) 1<=i<=N and 1<=j<=M. Examples: Input: A[]… Read More

Given integers L and R, the task is to find the number of integers in range [L, R] (say X) which does not form a… Read More

Given an array A[] and positive integer K, the task is to count the total number of pairs in the array whose product is divisible… Read More

Given a array vec and an integer K, count the number of pairs (i, j) such that vec[i]*vec[j] is divisible by K where i<j. Examples:… Read More

Given, two integers N (always even) and X, the task is to find an array of size N with distinct numbers, such that the sum… Read More

Given a range [L, R] and an integer K, the task is to check if it is possible to make the GCD of all integers… Read More

Given an array arr[] of 2 * N integers, the task is to find a set of N – 1 pairs such that the GCD… Read More

Given three positive integers X, Y, and Z. The task is to find two numbers A and B of X and Y digits respectively with… Read More

Given three integers L, R, and K. Consider an array arr[] consisting of all the elements from L to R, the task is to check… Read More

Given an array arr[] of N positive integers, the task is to find the smallest possible value of the last remaining element in the array… Read More

Given an array arr[] of size N. The task is to reorder arr[] and find the maximum number of GCD pairs which follows the conditions… Read More

Given an array arr[] of positive numbers. The task is to check if there exists any subset of any size such that after multiplying each… Read More