## Number of ways to merge two arrays such retaining order

Given two array of size n and m. The task is to find the number of ways we can merge the given arrays into one… Read More »

Given two array of size n and m. The task is to find the number of ways we can merge the given arrays into one… Read More »

We are given an integer N. We need to count the total number of such binary strings of length N such that the number of… Read More »

Given a number n, we need to find the maximum number of times n circles intersect. Examples: Input : n = 2 Output : 2… Read More »

An ordered tree is an oriented tree in which the children of a node are somehow ordered. It is a rooted tree in which an… Read More »

Following are common definition of Binomial Coefficients. A binomial coefficient C(n, k) can be defined as the coefficient of X^k in the expansion of (1… Read More »

Given a number n, find the number of ways to multiply n elements with an associative operation. Examples : Input : 2 Output : 2… Read More »

Given two positive integer n, k. Consider an undirected complete connected graph of n nodes in a complete connected graph. The task is to calculate… Read More »

Sum Rule – If a task can be done in one of ways or one of ways, where none of the set of ways is… Read More »

Given a string str, find count of all palindromic permutations of it. Examples: Input : str = “gfgf” Output : 2 There are two palindromic… Read More »

Given a number n and an array containing 1 to (2n+1) consecutive numbers. Three elements are chosen at random. Find the probability that the elements… Read More »

Given two numbers, n >= 0 and 0 <= k <= n, count the number of derangements with k fixed points. Examples: Input : n… Read More »

Given two positive integers N, M. The task is to find the number of strings of length N under the alphabet set of size M… Read More »

Given a number num containing n digits. The problem is to find the next greater number using the same set of digits in num on… Read More »

Prerequisite : Permutation and Combination Given a polygon of m sides, count number of triangles that can be formed using vertices of polygon. Answer :… Read More »

Given N, we have to find the sum of products of all combination taken 1 to N at a time. In simple words, we have… Read More »