## Number of pairs of arrays (A, B) such that A is ascending, B is descending and A[i] ≤ B[i]

Given two integers N and M, the task is to find the number of pairs of arrays (A, B) such that array A and B… Read More »

## Number of binary strings such that there is no substring of length ≥ 3

Given an integer N, the task is to count the number of binary strings possible such that there is no substring of length ≥ 3… Read More »

## Count of possible arrays from prefix-sum and suffix-sum arrays

Given 2*N integers which are elements of a prefix and suffix array(in shuffled order) of an array of size N, the task is to find… Read More »

## Count number of pairs (i, j) such that arr[i] * arr[j] = arr[i] + arr[j]

Given an array arr[] of length N, count the number of pairs (i, j) such that arr[i] * arr[j] = arr[i] + arr[j] and 0… Read More »

## Number of ways to convert a character X to a string Y

Given a character X and a string Y of length N and the task is to find the number of ways to convert X to… Read More »

## Expected number of moves to reach the end of a board | Dynamic programming

Given a linear board of length N numbered from 1 to N, the task is to find the expected number of moves required to reach… Read More »

## Find the sum of the costs of all possible arrangements of the cells

Given two integers N and M. At each operation, choose K cells of a 2D grid of size N * M and arrange them. If… Read More »

## Find ways to arrange K green balls among N balls such that exactly i moves is needed to collect all K green balls

Given two integers N and K. There are N balls placed in a row. K of them are green and N – K of them… Read More »

## Number of ways to reach (X, Y) in a matrix starting from the origin

Given two integers X and Y. The task is to find the number of ways to reach (X, Y) in a matrix starting from the… Read More »

## Number of subsets with sum divisible by M | Set 2

Given an array arr[] of N integers and an integer M, the task is to find the number of non-empty subsequences such that the sum… Read More »

## Program for nth Fuss–Catalan Number

Fuss–Catalan Numbers are a generalization of Catalan numbers that uses triplets instead of pairs. The Fuss-Catalan Numbers can be represented by a Series with the… Read More »

## Count of subsets with sum equal to X

Given an array arr[] of length N and an integer X, the task is to find the number of subsets with sum equal to X.… Read More »

## Sum of subsets of all the subsets of an array | O(N)

Given an array arr[] of length N, the task is to find the overall sum of subsets of all the subsets of the array. Examples:… Read More »

## Count of pairs in an array such that the highest power of 2 that divides their product is 1

Given an array arr[] of N positive integers. The task is to find the count of pairs (arr[i], arr[j]) such that the maximum power of… Read More »

## Sum of Digits of the Good Strings

A string is called good if it is made with only digits 0 to 9 and adjacent elements are different. The task is to find… Read More »