Find X such that elements at only alternate indices in given Array are divisible by X
Given an array arr[] of N integers, the task is to find an integer X such that the integers that are divisible by X and the integers that are not divisible by X are alternative to each other in the array. If there is no such value print -1....
read more
Smallest Subarray with given GCD
Given an array arr[] of n numbers and an integer k, find length of the minimum sub-array with gcd equals to k.Example:...
read more
Identical Subarrays through Modulo Operations
Given an array arr[] of size N. For each divisor of N, divide the array into N/K subarrays, each of length K. Your task is to determine how many distinct values of K exist such that there is a positive integer M (where M >= 2) that, if we replace each arr[i] with arr[i] MOD K, all the subarrays become identical....
read more
Check if an array can be split into subarrays with GCD exceeding K
Given an array arr[] of N integers and a positive integer K, the task is to check if it is possible to split this array into distinct contiguous subarrays such that the Greatest Common Divisor of all elements of each subarray is greater than K....
read more
Find element in array that divides all array elements
Given an array of n non-negative integers. Find such element in the array, that all array elements are divisible by it....
read more
Reach the numbers by making jumps of two given lengths
Given integers k, d1, d2 and an integer array arr[]. Starting from number k you are allowed to make jumps of size d1 and d2 i.e. all the possible moves from k are:...
read more
Count all pairs of divisors of a number N whose sum is coprime with N
Given an integer N, the task is to count all pairs of divisors of N such that the sum of each pair is coprime with N.Examples:...
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:...
read more
LCM of factorial and its neighbors
Given a number, we need to find LCM of the factorial of the numbers and its neighbors. If the number is N, we need to find LCM of (N-1)!, N! and (N+1)!.Here N is always greater than or equal too 1Examples :...
read more
HCF of array of fractions (or rational numbers)
Given a fraction series. Find the H.C.F of a given fraction series....
read more
Minimize sum of K positive integers with given LCM
Given two positive integers K and X, the task is to find the minimum possible sum of K positive integers ( repetitions allowed ) having LCM X....
read more
Find two numbers B and C such that their product is A and their GCD is maximum
Given a positive integer, A. The task is to find two numbers B and C such that their product is A and their GCD should be maximum....
read more