## Calculate the Sum of GCD over all subarrays

Given an array of integers, the task is to calculate the sum of GCD of all the subarrays of an array. GCD of an array… Read More »

- Count of integers that divide all the elements of the given array
- Count common elements in two arrays containing multiples of N and M
- Subsequence X of length K such that gcd(X[0], X[1]) + (X[2], X[3]) + ... is maximized
- Minimum deletions required to make GCD of the array equal to 1
- Remove an element to maximize the GCD of the given array
- Find two co-prime integers such that the first divides A and the second divides B
- Count the number of subsequences of length k having equal LCM and HCF
- Find the number of pairs such that their gcd is equals to 1
- Lexicographically largest permutation of the array such that a[i] = a[i-1] + gcd(a[i-1], a[i-2])
- Number of Quadruples with GCD equal to K
- Nth number in a set of multiples of A , B or C
- Check if all the elements can be made equal on dividing with X and Y
- GCD of elements which occur prime number of times
- Find numbers which are multiples of first array and factors of second array
- Sand Timer Flip Counting Problem
- Maximum count of common divisors of A and B such that all are co-primes to one another
- Find the ratio of number of elements in two Arrays from their individual and combined average

Given an array of integers, the task is to calculate the sum of GCD of all the subarrays of an array. GCD of an array… Read More »

Given an array arr[] of size N > 1. The task is to find the maximum possible GCD of the array by replacing at most… Read More »

Given N types of money denomination in a country as an array arr[]. A person and the shopkeeper can choose notes of each denomination any… Read More »

Given an array arr[], the task is to find the count of sub-arrays with GCD equal to 1. Examples: Input: arr[] = {1, 1, 1}… Read More »

Given an array health[] where health[i] is the health of the ith player in a game, any player can attack any other player in the… Read More »

Given an array arr[], the task is to find the smallest sub-arrays with GCD equal to 1. If there is no such sub-array then print… Read More »

Given an array arr[], the task is to find the number of sub-arrays with GCD value equal to 1. Examples: Input: arr[] = {1, 1,… Read More »

Given an array arr[] of length N, the task is to find the length of the longest sub-sequence with maximum possible GCD. Examples: Input: arr[]… Read More »

Given the average of elements in two arrays as ‘a’ and ‘b’ respectively, and their combined average as ‘c’, the task is to find the… Read More »

Given two arrays A[] and B[], the task is to find the integers which are divisible by all the elements of array A[] and divide… Read More »

Given two integers A and B. The task is to find the count of maximum elements from the common divisors of A and B such… Read More »

Given an array arr[] of N elements, the task is to find the GCD of the elements which have prime frequencies in the array. Note… Read More »

Given four integers N, A, B and C. The task is to print the Nth number in the set containing the multiples of A, B… Read More »

Given an array Arr and an integer K. The task is to find the number of subsequences of size K such that the LCM and… Read More »

Given an array a of size N. The task is to find the number of pairs such that gcd(a[i], a[j]) where 1 ≤ i <… Read More »