Skip to content

Tag Archives: GCD-LCM

Given an input arr[] of length N, Which contains integers from 1 to N in unsorted order. You can apply only one type of operation… Read More
Given an array A[] of length N, the task is to find the total number of distinct pairs (i, j) of indices where 1 ≤… Read More
Given an array A[] and M, the task is to check whether there exist M non-overlapping subarrays(non-empty) of A for which the average of the… Read More
Given a matrix of size N*M, the task is to find the product of all possible pairs of (i, j) where i and j are… Read More
Given an array B[] of length N, the task is to print an array A[] such that for every ith element B[i] is gcd of… Read More
Given an array A[] of the length N. The task is to find the minimum sum of the array (i.e. A1 + A2 + …… Read More
Given an integer array A[] of length N (N >= 1), the task is to print the total number of indices in the array that… Read More
Given two integers L and R, construct an array of given size N such that the GCD (Greatest Common Divisor) of the element with their… Read More
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