## Minimum edges to be added in a directed graph so that any node can be reachable from a given node

Given a directed graph and a node X. The task is to find the minimum number of edges that must be added to the graph… Read More »

## Minimum operations to make counts of remainders same in an array

Given an array arr[] of N integers and an integer M where N % M = 0. The task is to find the minimum number… Read More »

## Find index i such that prefix of S1 and suffix of S2 till i form a palindrome when concatenated

Given two strings A and B of equal lengths, the task is to find an index i such that A[0…i] and B[i+1…n-1] give a palindrome… Read More »

## Search element in a Spirally sorted Matrix

Given a spirally sorted matrix with N * N elements and an integer X, the task is to find the position of this given integer… Read More »

## Iterative Letter Combinations of a Phone Number

Given an integer array containing digits from [0, 9], the task is to print all possible letter combinations that the numbers could represent. A mapping… Read More »

## Merge K sorted arrays of different sizes | ( Divide and Conquer Approach )

Given k sorted arrays of different length, merge them into a single array such that the merged array is also sorted. Examples: Input : {{3,… Read More »

## Select numbers in such way to maximize the amount of money

Given two arrays A1 and A2 of N numbers. There are two people A and B who select numbers out of N. If A selects… Read More »

## Minimum number of elements that should be removed to make the array good

Given an array arr[], the task is to find the minimum number of elements that must be removed to make the array good. A sequence… Read More »

## Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M

Given a range [L, R] and two positive integers N and M. The task is to count the numbers in the range containing only non-zero… Read More »

## Ways to form an array having integers in given range such that total sum is divisible by 2

Given three positive integers N, L and R. The task is to find the number of ways to form an array of size N where… Read More »

## Generate a random permutation of elements from range [L, R] (Divide and Conquer)

Given a range [L, R] where L ≤ R, the task is to generate a random permutation of the sequence [L, L + 1, L… Read More »

## Smallest Special Prime which is greater than or equal to a given number

Given a number N. The task is to find the smallest special prime which is greater than or equal to N. A special prime is… Read More »

## Find a permutation such that number of indices for which gcd(p[i], i) > 1 is exactly K

Given two integers N and K, the task is to find a permutation of integers from the range [1, N] such that the number of… Read More »

## Minimum number of given moves required to make N divisible by 25

Given a number N(1 ≤ N ≤ 1018) without leading zeros. The task is to find the minimum number of moves required to make N… Read More »

## Iterating over all possible combinations in an Array using Bits

There arises several situations while solving a problem where we need to iterate over all possible combinations of an array. In this article, we will… Read More »