## Find minimum x such that (x % k) * (x / k) == n

Given two positive integers n and k. Find minimum positive integer x such that the (x % k) * (x / k) == n, where… 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
- Find a string such that every character is lexicographically greater than its immediate next character
- LCM of N numbers modulo M
- 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
- Smallest odd digits number not less than N
- Find last two digits of sum of N factorials
- Game of stones
- Expressing a fraction as a natural number under modulo 'm'
- Queries to count the number of unordered co-prime pairs from 1 to N
- 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
- Minimum number of square tiles required to fill the rectangular floor
- Find the number of primitive roots modulo prime
- Minimum Players required to win the game
- 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 two positive integers n and k. Find minimum positive integer x such that the (x % k) * (x / k) == n, where… Read More »

Given an array arr[] of integers, the task is to find the LCM of all the elements of the array modulo M where M =… Read More »

Given two integers A and B where A is not divisible by B, the task is to express A / B as a natural number… Read More »

Given a prime . The task is to count all the primitive roots of . A primitive root is an integer x (1 <= x… Read More »

Given an integer N which is the number of stones in a pile and the game of stones is being played between you and your… Read More »

Given an array of integers and a number K. The task is to sort only those elements of the array which yields remainder P upon… Read More »

Given three numbers a, b, n. Find GCD(an, b). Examples: Input : a = 2, b = 3, n = 3 Output : 1 2^3… Read More »

Given a number N, the task is to find the smallest number not less than N, which has all digits odd. Examples: Input: N =… Read More »

Given two integers ‘X’ and ‘N’, the task is to split the integer ‘X’ into exactly ‘N’ parts such that: X1 + X2 + X3… Read More »

Given an array, the task is to find the minimum and maximum elements in the array which is divisible by a given number k. Examples:… Read More »

Given a number N, the task is to find unit and tens places digit of the first N natural numbers factorials, i.e last last two… Read More »

Given a function f(n) = (13 + 23 + 33 + … + n3), the task is to find the value of f(n) mod 4… Read More »

Given a number N, the task is to check if it is prime or not using Wilson Primality Test. Print ‘1’ isf the number is… Read More »

Given a number N, the task is to find the Nth (N may be up to 10^18) term of this series: 2, 10, 24, 44,… Read More »

Quotient – Remainder Sort is a non-comparison based sorting algorithm. Steps to perform Quotient – Remainder sort as described below : Find MIN and MAX… Read More »