# Category Archives: Dynamic Programming

## Dynamic Programming | Set 8 (Matrix Chain Multiplication)February 2, 2012

Given a sequence of matrices, find the most efficient way to multiply these matrices together.

## Dynamic Programming | Set 7 (Coin Change)January 29, 2012

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1, S2, .. , Sm} valued coins, how many ways can we make the change? The order of coins doesn’t matter.

## Minimum number of jumps to reach endJanuary 24, 2012

Given an array of integers where each element represents the max number of steps that can be made forward from that element. Write a function to return the minimum number of jumps to reach the end of the array (starting from the first element).

## Length of the longest substring without repeating charactersDecember 2, 2011

Given a string, find the length of the longest substring without repeating characters. For example,

## Dynamic Programming | Set 6 (Min Cost Path)October 30, 2011

Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m, n) from (0, 0). Each cell of the matrix represents a cost to traverse through that cell.

## Dynamic Programming | Set 5 (Edit Distance)July 6, 2011

Given two strings str1 and str2 and below operations that can performed on str1. Find minimum number of edits (operations) required to convert ‘str1’ into ‘str2’. Insert Remove Replace All of the above operations are of equal cost. Examples: Input: str1 = “geek”, str2 = “gesek” Output: 1 We can convert str1 into str2 by… Read More »

## Dynamic Programming | Set 4 (Longest Common Subsequence)June 14, 2011

We have discussed Overlapping Subproblems and Optimal Substructure properties in Set 1 and Set 2 respectively.

## Dynamic Programming | Set 3 (Longest Increasing Subsequence)June 5, 2011

We have discussed Overlapping Subproblems and Optimal Substructure properties in Set 1 and Set 2 respectively.

## Dynamic Programming | Set 2 (Optimal Substructure Property)June 3, 2011

As we discussed in Set 1, following are the two main properties of a problem that suggest that the given problem can be solved using Dynamic programming: 1) Overlapping Subproblems 2) Optimal Substructure We have already discussed Overlapping Subproblem property in the Set 1. Let us discuss Optimal Substructure property here. 2) Optimal Substructure: A… Read More »

## Dynamic Programming | Set 1 (Overlapping Subproblems Property)June 1, 2011

Dynamic Programming is an algorithmic paradigm that solves a given complex problem by breaking it into subproblems and stores the results of subproblems to avoid computing the same results again.

## Program for Fibonacci numbersMarch 6, 2011

The Fibonacci numbers are the numbers in the following integer sequence.