Skip to content

Tag Archives: GCD-LCM

Given an array A[] of size N, find the permutation of array A such that the array B[] which is formed by taking the GCD… Read More
Given 3 integers N, L and R. The task is to construct an array A[] of N integers, such that : Each element of the… Read More
Given three integers X, Y, and Z. the task is to find the minimum distance between any two multiples of the given integers. Note: Common… Read More
Given a permutation arr[] of size N which is unsorted and contains all integers from 1 to N exactly once, the task is to find… Read More
Given two positive integers N and M, the task is to find the number of different GCDs which can be formed by adding an integer… Read More
Given an array arr[] of size N, the task is to count the number of indices in arr[] such that after changing the element of… Read More
Given integers X, Y, and K, the task is to make X and Y equal in not more than K operations by applying the following… Read More
LCM (Least Common Multiple) of two numbers is the smallest number which can be divided by both numbers. For example, LCM of 15 and 20… Read More
LCM (Least Common Multiple) of two numbers is the smallest number which can be divided by both numbers. For example, LCM of 15 and 20… Read More
Given an array arr[] of positive integers of size N, the task is to divide the array into two non-empty subsets X and Y in… Read More
Given an integer N, the task is to find two pairs of positive integers such that the GCD of the first pair is the same… Read More
Given two positive integers A and B, the task is to find two positive integers such that they belong in the range [A, B], such… Read More
Given an array arr[] having N integers, the task is to find the GCD of all the numbers in the array which are not prime.… Read More
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
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

Start Your Coding Journey Now!