## Number of ways to form an array with distinct adjacent elements

Given three integers N, M and X, the task is to find the number of ways to form an array, such that all consecutive numbers… Read More »

Given three integers N, M and X, the task is to find the number of ways to form an array, such that all consecutive numbers… Read More »

Given a sequence of N elements, only three operations can be performed on any element at most one time. The operations are: Add one to… Read More »

Given N numbers, find the number of permutations in which the sum of elements at odd index and sum of elements at even index are… Read More »

Given N and K. The task is to find out how many different ways are there to represent N as the sum of K non-zero… Read More »

Given a binary string and k, to check whether it’s contains all permutations of length k or not. Examples: Input : Binary string 11001 k… Read More »

Given two positive integers N and K. The task is to find the number of arrays of size N that can be formed such that… Read More »

Given a number n, the task is to find the nth hexadecagonal number. A Hexadecagonal number is class of figurate number and a perfect squares.… 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 »