# Category Archives: Dynamic Programming (adsbygoogle = window.adsbygoogle || []).push({});

## Longest palindrome subsequence with O(n) space

Given a sequence, find the length of the longest palindromic subsequence in it. Examples: Input : abbaab Output : 4 Input : geeksforgeeks Output :… Read More »

## Check for possible path in 2D matrix

Given a 2D array(m x n). The task is to check if there is any path from top left to bottom right. In the matrix,… Read More »

## Jacobsthal and Jacobsthal-Lucas numbers

The Jacobsthal sequence is an additive sequence similar to the Fibonacci sequence, defined by the recurrence relation Jn = Jn-1 + 2Jn-2, with initial terms… Read More »

## K maximum sums of non-overlapping contiguous sub-arrays

Given an Array of Integers and an Integer value k, find out k non-overlapping sub-arrays which have k maximum sums. Examples: Input : arr1[] =… Read More »

## Largest rectangular sub-matrix having sum divisible by k

Given a n x n matrix of integers. The problem is to find the largest area rectangular sub-matrix having sum divisible by the given value… Read More »

## Minimum number of deletions to make a string palindrome | Set 2

Given a string A, compute the minimum number of characters you need to delete to make resulting string a palindrome. Examples: Input : baca Output… Read More »

## Count ways to reach the nth stair using step 1, 2 or 3

A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. Implement… Read More »

## Newman-Conway Sequence

Newman-Conway Sequence is the one which generates the following integer sequence. 1 1 2 2 3 4 4 4 5 6 7 7… In mathematical… Read More »

## Maximum product of an increasing subsequence

Given an array of numbers, find the maximum product formed by multiplying numbers of an increasing subsequence of that array. Note: A single number is… Read More »

## Number of ways to form a heap with n distinct integers

Given n, how many distinct Max Heap can be made from n distinct integers? Examples: Input : n = 3 Output : Assume the integers… Read More »

## Hosoya’s Triangle

The Fibonnaci triangle or Hosoya’s triangle is a triangular arrangement of numbers based on Fibonacci numbers. Each number is the sum of two numbers above… Read More »

## Count number of increasing subsequences of size k

Given an array arr[] containing n integers. The problem is to count number of increasing subsequences in the array of size k. Examples: Input :… Read More »

## Different ways to sum n using numbers greater than or equal to m

Given two natural number n and m. The task is to find the number of ways in which the numbers that are greater than or… Read More »

## Entringer Number

The Entringer Number E(n, k) are the number of permutations of {1, 2, …, n + 1}, starting with k + 1, which, after initially… 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 »