Skip to content

Tag Archives: GCD-LCM

Given an array, arr[] of size N, Given M queries and each query consisting of a number X, the task is to subtract X from… Read More
Given arrays A[] and B[] each of length N and A[i] has all the elements from 1 to N, the task is to check if… Read More
Given an array arr[] of length N, the task is to find the number of subarrays where the least common multiple (LCM) of the subarray… Read More
 Given an integer N, the task is to find a minimum possible Y that satisfies the following condition: Y > N. Y is not divisible… Read More
GCD (Greatest Common Divisor) or HCF (Highest Common Factor) of two numbers is the largest number that divides both of them.  For example, GCD of… Read More
Given an integer arr[] of length N such that (Ai > 0) for all (1 ≤ i ≤ N) and an integer X. In one… Read More
Given a positive integer arr[] of length L (2 ≤ L ≤ 2000) containing elements from 1 to L in unsorted order and an integer… Read More
Given an array arr[] of length N consisting of positive integers and an integer X, the task is to find the maximum number of adjacent… Read More
Given an array arr[] of size N, the task is to minimize the number of distinct elements in the array after performing the following operation… Read More
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

Start Your Coding Journey Now!