## 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 »

## Maximum possible GCD after replacing at most one element in the given array

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 »

## Check whether the exchange is possible or not

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 »

## Number of subarrays with GCD = 1 | Segment tree

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 »

## Find the minimum possible health of the winning player

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 »

## Smallest subarray with GCD as 1 | Segment Tree

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 »

## Number of subarrays with GCD equal to 1

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 »

## Longest sub-sequence with maximum GCD

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 »

## Find the ratio of number of elements in two Arrays from their individual and combined average

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 »

## Find numbers which are multiples of first array and factors of second array

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 »

## Maximum count of common divisors of A and B such that all are co-primes to one another

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 »

## GCD of elements which occur prime number of times

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 »

## Nth number in a set of multiples of A , B or C

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 »

## Count the number of subsequences of length k having equal LCM and HCF

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 »

## Find the number of pairs such that their gcd is equals to 1

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 »