Difference between the largest and the smallest primes in an array

Given an array of integers where all the elements are less than 10^6. The task is to find the difference between the largest and the… Read More »

Number of distinct integers obtained by lcm(X, N)/X

Given a number , find the number of distinct integers obtained by lcm(X, N)/X where X can be any positive number. Examples: Input: N =… Read More »

Numbers in range [L, R] such that the count of their divisors is both even and prime

Given a range [L, R], the task is to find the numbers from the range which have the count of their divisors as even as… Read More »

Number of mismatching bits in the binary representation of two integers

Given two integers(less than 2^31) A and B. The task is to find the number of bits that are different in their binary representation. Examples:… Read More »

Sum of every K’th prime number in an array

Given an array of integers (less than 10^6), the task is to find the sum of all the prime numbers which appear after every (k-1)… Read More »

Check if a king can move a valid move or not when N nights are there in a modified chessboard

Given an infinite chessboard with the same rules as that of chess. Also given are N knights coordinates on the infinite chessboard(-10^9 <= x, y… Read More »

Minimum increment operations to make the array in increasing order

Given an array of size N and X. Find minimum moves required to make the array in increasing order. In each move one can add… Read More »

Print N lines of 4 numbers such that every pair among 4 numbers has a GCD K

Given N and K, the task is to print N lines where each line contains 4 numbers such that every among those 4 numbers has… Read More »

Check if a large number is divisible by 2, 3 and 5 or not

Given a number, the task is to check if a number is divisible by 2, 3 and 5 or not. The input number may be… Read More »

Maximize the number of subarrays with XOR as zero

Given an array of N numbers. The task is to maximize the number of subarrays with XOR value zero by swapping the bits of array… Read More »

Longest Subsequence with at least one common digit in every element

Given an array. The task is to find the length of the longest subsequence in which all elements must have at least one digit in… Read More »

Check whether it is possible to join two points given on circle such that distance between them is k

Given two circles and a length K. Find whether we can join two points (one on perimeter of each circle), so that distance between the… Read More »

Largest number with the given set of N digits that is divisible by 2, 3 and 5

Given a set of ‘N’ digits. The task is to find the maximum integer that we can make from these digits. The resultant number must… Read More »

Generate a number such that the frequency of each digit is digit times the frequency in given number

Given a number N containing digits from 1 to 9 only. The task is to generate a new number using the number N such that… Read More »

Check whether the given number is Euclid Number or not

Given a positive integer n, the task is to check if it is Euclid Number or not. Print ‘YES’ if the given number is Euclid… Read More »