## Product of first N factorials

Given a number N. Find the product of first N factorials modulo 1000000007. Constraints: 1 ≤ N ≤ 1e6 Examples: Input : 3 Output :… Read More »

- Modular exponentiation (Recursive)
- Merge Sort with O(1) extra space merge and O(n lg n) time
- Find minimum x such that (x % k) * (x / k) == n
- Modulo power for large numbers represented as strings
- Find the direction from given string
- Maximize the product of four factors of a Number
- Minimum and Maximum element of an array which is divisible by a given number k
- LCM of N numbers modulo M
- Find a string such that every character is lexicographically greater than its immediate next character
- Value of the series (1^3 + 2^3 + 3^3 + ... + n^3) mod 4 for a given n
- GCD of a number raised to some power and another number
- Find last two digits of sum of N factorials
- Smallest odd digits number not less than N
- Game of stones
- Queries to count the number of unordered co-prime pairs from 1 to N
- Expressing a fraction as a natural number under modulo 'm'
- Quotient - Remainder Sort
- Split the number into N parts such that difference between the smallest and the largest part is minimum
- Program to find sum of the given sequence
- Sum of Digits in a^n till a single digit
- Find the number of primitive roots modulo prime
- Minimum Players required to win the game
- Minimum number of square tiles required to fill the rectangular floor
- Program to find the Nth number of the series 2, 10, 24, 44, 70.....
- Implementation of Wilson Primality test
- Program to find last two digits of 2^n
- Sum of sum of all subsets of a set formed by first N natural numbers
- Find gcd(a^n, c) where a, n and c can vary from 1 to 10^9
- Print all substring of a number without any conversion
- Sort elements of array whose modulo with K yields P

Given a number N. Find the product of first N factorials modulo 1000000007. Constraints: 1 ≤ N ≤ 1e6 Examples: Input : 3 Output :… Read More »

Given integers x1, x2, x3……xn, b and m, we are supposed to find the result of ((x1*x2….xn)/b)mod(m). Example 1 : Suppose that we are required… Read More »

Given K, number of digits, and d0 and d1 as the two digits to form the k-sized integer. Task is to check whether the k-sized… Read More »

Given a, b and N(1 to 106). Task is to count the numbers formed by digits a and b exactly of a length N such… Read More »

Given an array of N non-negative integers, task is to find the maximum size of a subarray such that the pairwise sum of the elements… Read More »

Given an array A containing N non-negative integers. Only following operation can be performed on the array: A[i] = ( A[i] + 1 ) %… Read More »

Given A and B, the task is to find the number of possible values that X can take such that the given modular equation (A… Read More »

Given an array of N integers, using ‘+’ and ‘-‘ between the elements check if there is a way to form a sequence of numbers… Read More »

You are given a function f(n) = (n1 + n2 + n3 + n4), you have to find the value of f(n) mod 5 for… Read More »

Given two positive number N and X. The task is to find the sum of digits of a number formed by N repeating X number… Read More »

Given two positive integer x and y. we have to find the value of y mod 2x. That is remainder when y is divided by… Read More »

Give a positive integer n, find modular multiplicative inverse of all integer from 1 to n with respect to a big prime number, say, ‘prime’.… Read More »

Given an array and a number k, find the largest sum of contiguous array in the modified array which is formed by repeating the given… Read More »

Given a array size of n, find the last k digits (1 <= k < 10) of product of array numbers Examples: Input : a[]… Read More »

Given two numbers x and y, find unit digit of xy. Examples : Input : x = 2, y = 1 Output : 2 Explanation… Read More »