
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Master dynamic programming by solving the most frequently asked coding interview questions. Build a solid understanding of this tough topic, and gain confidence with a 30 day money back guarantee.
solve the 0/1 knapsack problem by selecting items from value and weight arrays under a capacity to maximize value using dynamic programming, illustrated with concrete examples.
Solve the 0/1 knapsack problem with a bottom-up 2d tabulation approach, building a dp table and mapping weights to capacities, then discuss space optimization to O(W).
Solve the 0/1 knapsack problem using 1D bottom-up tabulation, building a dynamic programming table from right to left to maximize value under a given capacity.
Solve the 0/1 knapsack problem using top-down dynamic programming with recursion, exploring take or skip decisions, and caching results to achieve O(n w) time and space.
Solve the target sum problem by placing plus or minus signs in front of each element to reach the target, enumerating combinations as shown for [1,1,1,1] target 2.
Learn how to solve target sum with a bottom-up dynamic programming approach by generating all possible targets, handling negative indexing with total, and building a DP table to count combinations.
Solve target sum with top-down dynamic programming using a DFS approach, exploring signs for each number and caching subproblem results to reduce exponential time.
Count subarrays in an integer array that sum to a given target, returning the total, including the empty subarray when the sum is zero, with examples totaling 3 and 2.
Count the number of subsets summing to a target with a bottom-up 2d dp table, using base cases and include/exclude, modulo 1e9+7, in n·s time and space.
Count subset sums using a bottom-up 1D tabulation. Build a sum table, traverse left-to-right and right-to-left, handle the base case and zeros, with modulo 1e9+7.
count the number of subarrays that sum to 10 using top-down dynamic programming. apply dfs with take or skip and memoize in a dp table for O(n·sum) time.
Partition an array into two subarrays to minimize the sum difference, and explore dynamic programming patterns for coding interviews.
Apply a top-down dynamic programming approach with memoization to the minimum sum partition problem, partitioning the array into two subarrays to minimize their absolute difference.
Solves the minimum sum partition problem with a bottom-up 1d tabulation dynamic programming approach, finding a subarray sum near half the total to minimize the partition difference.
Solve the minimum number of refueling stops to reach a target using start fuel, station distances, and fuel gains, with step-by-step reasoning and examples.
Explore top-down dynamic programming for the minimum refueling stops problem. Use DFS with memoization and a DP table to decide refuel or not at each station, yielding quadratic time.
Apply bottom-up dynamic programming to minimize refueling stops using a dp table with stations as rows and refueling counts as columns, starting from the initial fuel to reach the target.
Learn how to determine if an array of integers can be partitioned into two subarrays with equal sum, returning true or false as part of partition equal subset sum problems.
Use top-down dynamic programming to partition equal subset sum with a dfs over index and target, using take or skip and a memoized table for O(n·target) time and O(target) space.
Solve partition equal subset sum with a bottom-up 1D tabulation dynamic programming approach. Build a target-based boolean table to check if half the total can be formed.
Learn to count square submatrices with all 1s in a matrix, and determine the total number of such submatrices, as shown by examples returning 7, 11, and 16.
count square submatrices with all ones using top-down dynamic programming. the lecture uses a dfs with memoization and a dp table to optimize time to O(m) and space to O(m).
Use a bottom-up dynamic programming approach to count square submatrices with all ones by filling a dp table, referencing top, left, and diagonal cells, and summing results.
Solve the maximum ribbon cut problem with a top-down dynamic programming approach using DFS and memoization, maximizing the number of pieces from given sizes.
Learn to solve the maximum ribbon cut problem with a bottom-up 2d tabulation approach. Build a length n+1 dp table and use take-or-skip choices to maximize pieces.
Learn to solve rod cutting problem with top-down dynamic programming and memoization, using length and price arrays to maximize revenue via cutting versus not cutting, building a dynamic programming table.
Apply a bottom-up, 2d tabulation dynamic program to the rod cutting problem. Build a dp table indexed by rod length and item to maximize price from length and price arrays.
Solve the coin change problem with a top-down dynamic programming approach using memoization to find the fewest coins for a given amount. Build a DP table and optimize time.
Tackle the coin change problem with a bottom-up 1d tabulation approach, using a dynamic programming table to minimize coins for a given amount with infinite coin supply.
Solve coin change ii with top-down dynamic programming and memoization to count combinations that sum to a given amount using a coins array and two choices: take or skip.
Discover coin change ii using bottom up 2d tabulation to count combinations summing to a target amount with unlimited coins in a dynamic programming table.
Explore a bottom-up one-dimensional tabulation solution to coin change ii, counting all combinations to form a target amount with infinite coin supply using dynamic programming.
Use top-down dynamic programming to compute the nth fibonacci number with recursion and memoization. Initialize a dp table with -1 and base cases fib(0)=0 and fib(1)=1.
Compute the nth fibonacci number using bottom up dynamic programming. Use a 1d tabulation table, initialize 0 and 1, and fill dp[i] = dp[i-1] + dp[i-2] to return dp[n].
Compute the Fibonacci number in O(n) time with constant space by a bottom-up dynamic programming approach using two variables and a temp value in a loop from 2 to n.
Demonstrate solving the climbing stairs problem with top-down dynamic programming, using base cases and a memoized dp table to sum n-1 and n-2 paths.
Master a bottom-up dynamic programming solution to the climbing stairs problem, computing the number of ways to reach stair n as the sum of n-1 and n-2, with space-optimized variants.
Apply top-down dynamic programming to count decoding ways for a digit string, using recursion and memoization to handle zeros and two-digit merges up to 26.
Solve decode ways with a bottom-up dynamic programming approach using 1d tabulation to count the number of valid decodings for digit strings mapped from 1 to 26.
Solve decode ways with a bottom-up, space-optimized dynamic programming approach, delivering a linear-time, constant-space solution that counts all valid decodings, as shown with 226.
Solve the house robber problem with a top-down dynamic programming approach, using memoization to handle two choices (rob or not rob) and base-case conditions.
Learn to solve the house robber problem with bottom-up dynamic programming, computing the maximum non-adjacent sum and optimizing space to O(1) using two variables.
Solve the number factors problem with top-down dynamic programming by counting ways to sum to n using 1, 3, and 4, via memoized recursion and a dp table.
Learn a bottom-up dynamic programming approach to count the number of ways to sum N using 1, 3, and 4, via a one-dimensional DP table and base case for zero.
Count the number of ways to reach a target score using 1, 2, or 4 points, where the order of scores matters, solved via top down dynamic programming and memoization.
Count the ways to reach a target score n using 1, 2, or 4 points with a bottom-up 1-D dynamic programming approach.
Count the number of unique paths from the top-left to the bottom-right in an obstacle-filled m by n matrix, moving right or down, using top-down dynamic programming and memoization.
Apply bottom-up dynamic programming to compute unique paths from top-left to bottom-right in a grid with obstacles. Move only down or right, where 1 is obstacle and 0 is free.
Learn the top-down dynamic programming solution for the nth Tribonacci number using memoization and a dp table, with base cases and linear time and space.
Compute the nth tribonacci number using bottom-up dynamic programming. Build a dp table with base cases and sum the three preceding numbers, then optimize to O(1) space.
Explore computing the nth Catalan number via a top-down dynamic programming approach with memoization, recursion, and a dynamic programming table, achieving O(n^2) time and O(n) space.
Apply bottom-up dynamic programming to compute Catalan numbers with a dp table and Cn recurrence, using C0 and C1 as base cases and achieving O(n^2) time and O(n) space.
Master the minimum jumps to reach the end with a top-down dynamic programming approach. Use DFS with memoization and a DP table to beat exponential time.
Apply bottom-up dynamic programming to solve the minimum jumps to reach the end. Build a DP table, initialize with infinity, and compute per-index jumps in O(n^2) time and O(n) space.
Solve the minimum jumps with a fee using top down dynamic programming and memoization, by jumping 1–3 steps to reach beyond the top with minimal cost.
Use a bottom-up dynamic programming approach to solve the minimum fee problem by building a dp table that minimizes cost for one-, two-, or three-step jumps beyond the top step.
solve matrix chain multiplication by using a top-down dynamic programming approach to minimize primitive multiplications, with memoization to achieve efficient O(n^3) time.
solve matrix chain multiplication with bottom up dynamic programming, filling an n by n dp table by diagonals and evaluating subproblems with k splits to combine left and right results.
Solve the longest common substring with a top-down dynamic programming approach using i, j, and count states, then memoize in a 3D DP for O(m n^2) time and space.
Master the longest common substring with a bottom-up dynamic programming approach. Build a DP table for S1 and S2, track contiguous matches, and compute the maximum length in O(n1*n2) time.
Solve the longest common subsequence problem using top-down dynamic programming to compute its length, with base cases for empty strings and memoization to avoid recomputing subproblems.
Determine the length of the longest common subsequence for two strings using bottom-up dp. Build a 2D (m+1) by (n+1) table, use diagonal +1 for matches and take max otherwise.
Learn to compute the shortest common supersequence length for two strings using top down dynamic programming with memoization, base cases, and a dp table for efficient coding interview solutions.
Compute the length of the shortest common supersequence for two strings using bottom-up dynamic programming. Build a (m+1) by (n+1) dp table and analyze O(mn) time and space.
Transform one string into another by computing the longest common subsequence with a bottom-up dynamic programming approach, then return deletions and insertions as n1 minus lcs and n2 minus lcs.
Transform one string into another by computing the longest common subsequence, then derive deletions and insertions with a top-down dynamic programming approach using memoization.
solve the edit distance problem using a top-down dynamic programming approach with memoization to transform word one into word two using insert, delete, and replace operations.
Solve edit distance with bottom-up 2d tabulation, building a (m+1) by (n+1) dynamic programming table, and use insert, delete, and replace to transform word one into word two.
Solve the longest repeating subsequence with a top-down dynamic programming approach and memoization, enforcing distinct indices for reused characters and achieving quadratic time and space.
Solve the longest repeating subsequence with bottom-up dynamic programming using an (n+1) by (n+1) table, comparing characters at different indices, in O(n^2) time and space.
Learn to count how many times a distinct pattern appears as a subsequence in a string using top-down dynamic programming, with memoization to optimize overlapping subproblems.
Solve distinct subsequence pattern matching with a bottom-up dynamic programming approach to count how many times s2 appears in s1 as a subsequence, using a (n1+1) by (n2+1) dp table.
Explore solving the interleaving string problem using top-down dynamic programming with dfs and memoization, checking if s3 can be formed by interleaving s1 and s2 while preserving relative order.
Solve the interleaving string problem by checking if S3 can be formed by interleaving S1 and S2 using a bottom-up dynamic programming table.
Learn a bottom-up dynamic programming approach to the word break problem using a 1D tabulation and a hash set of dictionary words to decide if the string can be formed.
Explore bottom-up dynamic programming to solve word break ii, generating all valid sentences from a string using a word dictionary via a dp table of lists.
Explore top-down word break II: generate all sentences by inserting spaces into a string using dictionary words, using recursion with memoization to cache subproblem results.
Solve the longest increasing subsequence problem and return its length, illustrated by array examples showing outputs such as 4 or 1.
Compute the longest increasing subsequence with a bottom-up 1D tabulation dynamic programming approach. Build a dp table to solve LIS in O(n^2) time and O(n) space, enforcing strictly increasing subsequences.
Solve the longest increasing subsequence with top-down dynamic programming approach using dfs and memoization, explaining take or skip decisions and how a dynamic programming table yields O(n^2) time and space.
Explore a bottom-up dynamic programming solution to the number of longest increasing subsequences. Learn to use length and count arrays, analyze O(n^2) time and O(n) space.
Learn to compute the minimum deletions to make an array strictly increasing using the longest increasing subsequence and bottom-up dynamic programming.
Learn to compute the minimum deletions to make a sequence sorted by using the longest increasing subsequence, via top-down dynamic programming with memoization.
Solve the maximum sum increasing subsequence problem with a top-down dynamic programming approach using memoization, and learn to build a dp table to optimize overlapping subproblems.
Solve the maximum sum increasing subsequence using a bottom-up dynamic programming approach, building a dp table to track the maximum sums and return the overall maximum.
Discover how to solve the longest bitonic subsequence problem with a bottom-up dynamic programming approach using forward and backward longest increasing subsequences, achieving O(n^2) time.
Apply dynamic programming with a bottom-up solution for the longest alternating subsequence. Use two variables to track increasing and decreasing lengths in one pass, delivering O(n) time and O(1) space.
Sort the bridge pairs by south coordinates, then compute the longest increasing subsequence of the north coordinates to maximize non-overlapping bridges. The approach runs in O(n^2) time and O(n) space.
Solve the longest palindromic subsequence with top-down memoization and DFS on start/end indices, and show a DP table to achieve o(n^2) time and space.
Solve the longest palindromic subsequence with bottom-up dynamic programming on a 2d tabulation table using start and end indices to compute the length in O(n^2) time.
Learn to compute the minimum deletions to make a string palindrome by deriving deletions from n minus the longest palindromic subsequence using top-down dynamic programming with memoization.
Compute the minimum deletions to make a string palindrome using a bottom-up two-dimensional dynamic programming approach to find the longest palindromic subsequence and derive deletions as length minus that subsequence.
Solve the longest palindromic substring using a top-down dynamic programming approach. Implement recursive calls with start and end indices, memoize results in an n-by-n table to achieve O(n^2) time.
Solve the longest palindromic substring problem with a bottom-up dynamic programming approach, building and filling an n-by-n DP table to compute the result in O(n^2) time and space.
Learn to count palindromic substrings using a top down dynamic programming method, checking substrings: indices i and j, with three recursive choices and caching results in a dynamic programming table.
Count palindromic substrings with a bottom-up dynamic programming table, initializing single-character substrings as true, then propagate to identify longer palindromes and return the total.
Solve the palindrome partitioning problem using a top-down dynamic programming approach with a DFS to minimize cuts that partition the string into palindromic substrings, using memoization.
Learn to compute the minimum cuts to partition a string into palindromic substrings using a bottom-up dynamic programming approach. Build a palindrome table and a dp table to solve efficiently.
Are you struggling with dynamic programming (DP) problems in coding interviews? You’re not alone. This course, Dynamic Programming Patterns for Coding Interviews, is designed to help you master DP concepts, recognize common DP patterns, and confidently solve coding interview problems at top tech companies like Google, Amazon, and Microsoft.
What You’ll Learn:
Dynamic Programming Fundamentals – recursion, memoization, tabulation, and overlapping subproblems
Identify DP Patterns – learn the key patterns that appear in coding interviews
Hands-on Java Coding – solve 30+ real-world DP problems using Java
Interview-Ready Problem Solving – tackle questions from LeetCode, HackerRank, and Google-style interviews
Data Structures Essentials – arrays, strings, matrices, and graphs applied in DP problems
Step-by-Step Solutions – clear walkthroughs for every problem, so you understand the logic completely
Why This Course?
Gain the confidence to solve dynamic programming problems quickly
Recognize repeating patterns in DP questions and apply them effectively
Apply Java programming skills to real interview problems
Prepare for coding interviews at top tech companies with practical, hands-on examples
Whether you’re a beginner or an experienced programmer, this course will equip you with the skills, strategies, and confidence to excel in coding interviews and competitive programming challenges.
30-day money-back guarantee – enroll today and start mastering dynamic programming patterns for coding interviews!