0% found this document useful (0 votes)
6 views

Fibonacci Sequence Using DP

The document outlines various dynamic programming problems and their solutions, including the Fibonacci sequence, climbing stairs, coin change, and longest common subsequence. Each problem is accompanied by key concepts and techniques for solving them, such as memoization, tabulation, and 2D DP tables. Additional problems mentioned include the knapsack problem, edit distance, and unique paths in a grid, among others.

Uploaded by

dhruvmalviya344
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Fibonacci Sequence Using DP

The document outlines various dynamic programming problems and their solutions, including the Fibonacci sequence, climbing stairs, coin change, and longest common subsequence. Each problem is accompanied by key concepts and techniques for solving them, such as memoization, tabulation, and 2D DP tables. Additional problems mentioned include the knapsack problem, edit distance, and unique paths in a grid, among others.

Uploaded by

dhruvmalviya344
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

 Fibonacci Sequence Using DP yes revised

Write a function to calculate the nth Fibonacci number using memoization (top-down) or tabulation
(bottom-up).
Concepts: Base cases; caching results; recursion vs. iteration.
medium.com

 Climbing Stairs yes revised


Given n stairs and the ability to take 1 or 2 steps at a time, determine the total number of ways to
reach the top.
Concepts: Recurrence relation similar to Fibonacci; counting paths.
medium.com

 Coin Change (Minimum Coins) yes revised


Find the minimum number of coins required to make up a given amount with available coin
denominations.
Concepts: Minimization; iterative DP using a 1D table.
en.wikipedia.org

 Coin Change (Count Ways) yes revised


Count the number of ways to make change for a given amount.
Concepts: Counting paths; unbounded knapsack variation.

 Longest Common Subsequence (LCS) yes revised


Given two strings, write a function that finds the length (or the actual subsequence) of their longest
common subsequence.
Concepts: 2D DP table; backtracking for sequence reconstruction.
leetcode.com

 Longest Common Substring yes revised


Find the longest contiguous sequence (substring) that appears in both strings.
Concepts: Resetting counts on mismatch; tabulation with extra row/column for base cases.

 Longest Palindromic Substring yes do after


Given a string, identify the longest substring that is a palindrome.
Concepts: 2D DP where dp[i][j]=dp[i+1][j-1]+1 if a match; resetting on mismatch.

 0/1 Knapsack Problem yes revised


Given weights, values, and a maximum capacity, determine the maximum value achievable without
exceeding the capacity.
Concepts: Decision making (include/exclude items); 2D DP; classic optimization.

 Edit Distance (Levenshtein Distance) yes revised


Find the minimum number of insertions, deletions, and substitutions required to convert one string
into another.
Concepts: 2D DP table; cost accumulation; backtracking (optional).

 Maximum Subarray (Kadane’s Algorithm) yes revised


Determine the contiguous subarray within an array that has the maximum sum.
Concepts: Iterative update of “current maximum”; greedy-DP hybrid.

 Unique Paths in a Grid yes revised


Calculate the number of distinct paths from the top-left to the bottom-right corner in an m×n grid
(only right and down moves allowed).
Concepts: 2D DP; summing ways from adjacent cells.

 Partition Equal Subset Sum yes revised


Given a set of positive integers, determine if the set can be partitioned into two subsets with equal
sum.
Concepts: Subset sum; boolean DP table.

 Longest Increasing Subsequence (LIS) yes revised


Find the length (or the subsequence itself) of the longest strictly increasing subsequence in an array.
Concepts: 1D DP with comparisons; potential O(n log n) optimizations.

 Word Break Problem


Given a string and a dictionary of words, determine if the string can be segmented into a space-
separated sequence of one or more dictionary words.
Concepts: 1D DP based on substring validity; state transition based on word-length.

 Burst Balloons
Given an array representing balloons with numbers, determine the maximum coins that can be
collected by bursting them in an optimal order.
Concepts: Interval DP; choosing optimal order of operations.

 Decode Ways
Given a string containing only digits (representing encoded letters), count the total number of ways
to decode it.
Concepts: 1D DP similar to Fibonacci; careful handling of edge cases (e.g., zeros).

 Minimum Path Sum in a Grid yes revised


Find a path from the top-left to the bottom-right of a grid that minimizes the sum of all numbers
along the path.
Concepts: 2D DP with summing minimal cost path.

 Egg Dropping Puzzle


With a given number of eggs and a building with a certain number of floors, determine the minimum
number of trials needed in the worst-case scenario to find the critical floor.
Concepts: Binary search optimization in DP; state defined by (eggs, floors).

 Longest Palindromic Subsequence yes revised


Given a string, find the length (or the subsequence itself) of the longest subsequence that is a
palindrome.
Concepts: 2D DP similar to LCS, but with the string and its reverse or using other recurrence.

 Arithmetic Slices
Given an array, count the number of contiguous subarrays (with at least three elements) that form an
arithmetic sequence (the difference between consecutive elements is constant).
Concepts: 1D DP where you extend previous arithmetic sequences and sum up the counts.

Rod cutting = yes revised

House robber

Maximum non adjacent

You might also like