dynamic-programming

Define states and reconstruct solutions for optimization problems using dynamic programming.

7|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/Arcadi4/nerdy --skill dynamic-programming-arcadi4
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dynamic-programming
Source: https://github.com/Arcadi4/nerdy/tree/main/clrs/dynamic-programming
Command: npx skills add https://github.com/Arcadi4/nerdy --skill dynamic-programming-arcadi4

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dynamic programming provides a disciplined method to solve optimization and counting problems by exploiting optimal substructure and overlapping subproblems, avoiding exponential blowups through memoization or bottom-up tabulation.

Core Features & Use Cases

  • Identify when a problem exhibits optimal substructure and overlapping subproblems.
  • Learn the standard DP workflow: state definition, recurrence, bottom-up or memoization, and reconstruction.
  • Common patterns include rod cutting, matrix-chain multiplication, longest common subsequence, and optimal BSTs, among others.

Quick Start

Use this skill to recognize DP opportunities and outline a solution approach for a given problem.

Frequently Asked Questions about dynamic-programming

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify overlapping subproblems and optimal substructure for dynamic programming?

To identify overlapping subproblems and optimal substructure for dynamic programming, verify if the main optimization problem can be broken into smaller subproblems whose optimal solutions combine into the overall optimal solution, and check if these subproblems are solved repeatedly.

When should I use bottom-up tabulation versus memoization in dynamic programming?

Use bottom-up tabulation in dynamic programming when you need strict control over the computation order and want to avoid recursion limits, whereas memoization is preferable when only a subset of subproblems actually needs evaluation during execution.

What is the standard workflow to solve optimization problems using dynamic programming?

The standard dynamic programming workflow involves defining problem states, proving the optimal substructure, formulating the recurrence relation, computing results once using bottom-up or memoized approaches, and finally reconstructing the exact solution from the cached data.

How do I reconstruct the optimal solution after computing dynamic programming states?

To reconstruct the optimal solution after computing dynamic programming states, you store predecessor pointers or decisions alongside your tabulated values, then trace backwards from the final state to the base case to assemble the complete sequence.

Can dynamic programming be applied to matrix-chain multiplication and longest common subsequence problems?

Dynamic programming can be directly applied to matrix-chain multiplication and longest common subsequence problems, as both exhibit optimal substructure and overlapping subproblems suitable for caching intermediate results to avoid exponential blowups.