# Minimum cost to reach the end of the array using recursion and dynamic programming

Given an array of different costs(which is positive integers) of size ‘N.’ And a maximum possible jump from the current index to other index is ‘K.’ We aim to find the minimum cost to reach the end of the array. Let’s take below example to understand this problem better. In the above example, starting fromRead More »

# Longest palindromic subsequence length of a string

Given an input string of size ‘N’ characters. We aim to find maximum length subsequence which is palindromic. A subsequence string is a sequence that is formed by another sequence by removing zero or more characters. Whereas a palindrome string is a string that can be read the same from the backward as forward. WeRead More »

# Longest common subsequence length of given two strings

A subsequence is a sequence formed by another sequence after removal of 0 or more items from it. The order that items appear won’t change in the subsequence. In strings, a subsequence string generates by removing 0 or more characters from the parent string. A common subsequence is a subsequence generated from two string. Let’sRead More »

# Count of all subsets with given sum in an unsorted integer array

Given an array of unsorted integers of size ‘N,’ we aim to find all subsets count with sum is equivalent to a given sum. A subset array is an array in which all the items on it exists in another bigger array. Here the array is called subset to the larger array. To find theRead More »

# House thief problem (using recursion and dynamic programming)

A thief knows all gold reserves of a neighborhood that is in a single row. Thief want’s to have a plan earlier on which houses he wants to steal. To avoid a triggering alarm his condition is to avoid stealing any two houses which are right next to each other. Let’s understand this problem withRead More »

# 0/1 Knapsack problem example with recursion and dynamic programming solutions

A farmer wants to sell his farm products in the city. He has a knapsack with the capacity of “N” kgs weight, and he has products with more than ‘N’ kgs weight. He wants to fill his backpack in such a way that he gets more money after selling the products in the knapsack. HereRead More »

# Coin change problem (Find all number of combinations that formed a sum amount with given denominations)

Given a set of denominations of coins and an amount, our aim is find number of combinations in which we can arrange denominations to form our input amount. Let’s understand this better with following example. We can solve this problem using below two different approaches. Recursion Dynamic Programming. Recursion Let’s divide our problem into smallerRead More »

# Fibonacci series using recursion and dynamic programming

Fibonacci series is a series of Fibonacci numbers. A Fibonacci number is denoted as the sum of its two preceding numbers in the series. These numbers are starting from 0 and 1. Let’s see the mathematical formula for the Fibonacci number. There is an exponential number of real-world applications on the Fibonacci numbers. As perRead More »

# Best complexity edit distance algorithm with an example

Edit distance The minimum number of operations on a string (array of characters) to convert into another input string is called the edit distance between the two strings. The operations can be Insert a character, Remove a character, or Replace a character with another. We can solve this problem using recursion. Now let’s take aRead More »

# Find a subset of the given array with a given sum

Given an input array and a sum value as inputs and the algorithm needs to find whether there exists a subset of the input array which sums up to a given sum. Let’s try to understand the problem with some example input values. The should be a recursive solution to this problem. Let’s write aRead More »