##
Print last k digits of a^b (a raised to power b)
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 »

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 »

May 1, 2017

Given an integer a, b, m. Find (a * b ) mod m, where a, b may be large and their direct multiplication may cause… Read More »

April 29, 2017

In most of the programming competitions, problems are required to answer the result in 10^9+7 modulo. The reason behind this is to have problems for… Read More »

April 13, 2017

Given a string consisting of integers 0 to 9. The task is to count the number of substrings which when convert into integer are divisible… Read More »

March 8, 2017

Given an array of integer numbers, we need to find maximum size of a subset such that sum of each pair of this subset is… Read More »

March 7, 2017

Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, third-second max, fourth-second… Read More »

March 2, 2017

Given an array of n elements and an integer m. The task is to find the maximum value of the sum of its subarray modulo… Read More »

February 27, 2017

Given a string consisting of digits 0-9, count the number of subsequences in it divisible by m. Examples: Input : str = “1234”, n =… Read More »