# Category Archives: Dynamic Programming

## Entringer Number

The Entringer Number E(n, k) are the number of permutations of {1, 2, …, n + 1}, starting with k + 1, which, after initally… Read More »

## Count of possible hexagonal walks

We are given an infinite two dimensional plane made of hexagons connected together. We can visualize this plane as a honeycomb. Element X is present… Read More »

## Eulerian Number

In combinatorics, the Eulerian Number A(n, m), is the number of permutations of the numbers 1 to n in which exactly m elements are greater… Read More »

## Newman–Shanks–Williams prime

In mathematics, a Newman–Shanks–Williams prime (NSW prime) is a prime number p which can be written in the form: Recurrence relation for Newman–Shanks–Williams prime is:… Read More »

## Lobb Number

In combinatorial mathematics, the Lobb number Lm, n counts the number of ways that n + m open parentheses can be arranged to form the… Read More »

## Number of ways to insert a character to increase the LCS by one

Given two strings A and B. The task is to count the number of ways to insert a character in string A to increase the… Read More »

## Longest Increasing Odd Even Subsequence

Given an array of size n. The problem is to find the length of the subsequence in the given array such that all the elements… Read More »

## Delannoy Number

In mathematics, a Delannoy number D describes the number of paths from the southwest corner (0, 0) of a rectangular grid to the northeast corner… Read More »

## Longest alternating (positive and negative) subarray starting at every index

A subarray is called alternating if any two consecutive numbers in it have opposite signs (i.e. one of them should be negative, whereas the other… Read More »

## Maximum value with the choice of either dividing or considering as it is

We are given a number n, we need to find the maximum sum possible with the help of following function: F(n) = max( (F(n/2) +… Read More »

## Maximum difference of zeros and ones in binary string

Given a binary string of 0s and 1s. The task is to find the length of substring which is having maximum difference of number of… Read More »

## WildCard pattern matching having three symbols ( * , + , ? )

Given a text and a wildcard pattern, implement wildcard pattern matching algorithm that finds if wildcard pattern is matched with text. The matching should cover… Read More »

## Count of arrays having consecutive element with different values

Given three positive integers n, k and x. The task is to count the number of different array that can be formed of size n… Read More »

## Number of palindromic subsequences of length k

Given a string S of length n and a positive integer k. The task is to find number of Palindromic Subsequences of length k. Examples:… Read More »

## Check if possible to cross the matrix with given power

Given a matrix of N X M, each cell consist of an integer. We have initial power of K and we are allowed to move… Read More »