## Split the number into N parts such that difference between the smallest and the largest part is minimum

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 »

- Top 10 Algorithms and Data Structures for Competitive Programming
- Program for Fibonacci numbers
- Modular Exponentiation (Power in Modular Arithmetic)
- Write a program to calculate pow(x,n)
- Modulo 10^9+7 (1000000007)
- Modular multiplicative inverse
- Compute nCr % p | Set 1 (Introduction and Dynamic Programming Solution)
- Rabin-Karp Algorithm for Pattern Searching
- Count all sub-arrays having sum divisible by k
- Friends Pairing Problem
- Euler's Totient Function
- Compute nCr % p | Set 2 (Lucas Theorem)
- Primality Test | Set 2 (Fermat Method)
- Compute nCr % p | Set 3 (Using Fermat Little Theorem)
- Sum of all Subarrays | Set 1
- Primality Test | Set 3 (Miller–Rabin)
- Matrix Exponentiation
- Modular Division
- Count number of ways to partition a set into k subsets
- Rearrange an array in maximum minimum form | Set 2 (O(1) extra space)
- Write a program to reverse digits of a number
- Number of subsequences in a string divisible by n
- Exponential Squaring (Fast Modulo Multiplication)
- GCD of two numbers when one of them can be very large
- Last non-zero digit of a factorial
- Compute n! under modulo p
- Check if any valid sequence is divisible by M
- Find all pairs (a, b) in an array such that a % b = k
- Find Last Digit of a^b for Large Numbers
- Multiply two numbers represented by Linked Lists

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 »

Given a string of containing only L’s and R’s which represents left rotation and right rotation respectively. The task is to find the final direction… Read More »

Given two numbers a and n, the task is to find the single sum of digits of a^n (pow(a, n)). In single digit sum, we… Read More »

Given N questions and K options for each question, where and . The task is to determine sum of total number of player who has… Read More »

Given an integer N, the task is to find the maximum product of A, B, C, D such that below conditions satisfy: N%A ==0 &&… Read More »

Given two numbers and . The task is to find the sum of the sequence given below. (1*2*3*…*k) + (2*3*…*k*(k+1)) + (3*4*..*(k+1)*(k+2)) +…..+((n-k+1)*(n-k+2)*…*(n-k+k)). Since the… Read More »

Given a rectanglular floor of (M X N) meters is to be paved with square tiles of (s X s). The task is to find… Read More »

Given an integer N, the task is to print all the substring of N without doing any conversion i.e converting it into a string or… Read More »

Given two numbers sa and sb represented as strings, find ab % MOD where MOD is 1e9 + 7. The numbers a and b can… Read More »