##
Given two numbers a and b find all x such that a % x = b
November 21, 2017

Given two numbers a and b find all x such that a % x = b . Examples: Input : a = 21, b =… Read More »

November 21, 2017

Given two numbers a and b find all x such that a % x = b . Examples: Input : a = 21, b =… Read More »

November 13, 2017

Given an array A[] of size N. Solve Q queries. Find the product in range [L, R] under modulo P ( P is Prime). Examples:… Read More »

November 11, 2017

Given two numbers base and exp, we need to compute baseexp under Modulo 10^9+7 Examples: Input : base = 2, exp = 2 Output :… Read More »

November 3, 2017

Given an array A[] (1

October 23, 2017

Given an array, find product of all array elements. Examples: Input : ar[] = {1, 2, 3, 4, 5} Output : 120 Product of array… Read More »

October 19, 2017

Given an integer array and two numbers k and m. Print k numbers from the array, such that difference between any two pairs is divisible… Read More »

August 23, 2017

M items are to be delivered in a circle of size M. Find the position where the M-th item will be delivered if we start… Read More »

July 12, 2017

Given positive integers k, a and b we need to print last k digits of a^b ie.. pow(a, b). Input Constraint: k <= 9, a… Read More »

June 29, 2017

Given three integers a, b and m. Find an integer k such that where a and m are relatively prime. If it is not possible… Read More »

June 25, 2017

Given an array with distinct elements, the task is to find the pairs in the array such that a % b = k, where k… Read More »

June 18, 2017

Given an array of n integers .We need to find all ‘k’ such that arr[0] % k = arr[1] % k = ……. = arr[n-1]… Read More »

June 16, 2017

Given an array of n integers. Find the maximum value of arr[i] mod arr[j] where arr[i] >= arr[j] and 1 <= i, j <= n… Read More »

June 11, 2017

The Fibonacci sequence is defined as = + where = 1 and = 1 are the seeds. For a given prime number p, consider a… Read More »

May 16, 2017

Given N modular equations: A ≅ x1mod(m1) . . A ≅ xnmod(mn) Find x in the equation A ≅ xmod(m1*m2*m3..*mn) where mi is prime, or… Read More »

May 4, 2017

Given three numbers n, r and p, compute value of nCr mod p. Here p is a prime number greater than n. Here nCr is… Read More »