dynamic-programming

Formalize states, transitions, and base cases for dynamic programming solutions.

7|Updated Feb 14, 2026
One-click install
npx skills add https://github.com/KentoShimizu/sw-agent-skills --skill dynamic-programming-kentoshimizu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dynamic-programming
Source: https://github.com/KentoShimizu/sw-agent-skills/tree/main/skills/dynamic-programming
Command: npx skills add https://github.com/KentoShimizu/sw-agent-skills --skill dynamic-programming-kentoshimizu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps engineers design correct and efficient dynamic programming solutions by explicitly modeling subproblems, decisions, and optimization strategies.

Core Features & Use Cases

  • Define state, transitions, and base-case formulations for subproblems.
  • Guide the choice between top-down memoization and bottom-up tabulation.
  • Use case: craft DP solutions for classic problems like knapsack, shortest path in grids, and sequence alignment.

Quick Start

Describe a subproblem and objective, then request a DP formulation with state definitions, transitions, and base cases.

Frequently Asked Questions about dynamic-programming

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

FAQPage Schema
How do I design a dynamic programming solution with correct state transitions?

To design a dynamic programming solution, you formalize states, transitions, base cases, and optimization strategies. This approach handles problems with optimal substructure and overlapping subproblems by rigorously defining valid state transitions.

When should I use top-down memoization versus bottom-up tabulation for DP?

Top-down memoization and bottom-up tabulation are both supported approaches for dynamic programming. Choosing between them depends on your state modeling preferences and specific subproblem optimization strategy requirements.

How do I model subproblems for sequence alignment using dynamic programming?

Modeling subproblems for sequence alignment requires defining explicit states and decisions satisfying optimal substructure. You formulate valid transitions and base cases to construct the dynamic programming solution correctly.

Does dynamic programming work for solving the knapsack optimization problem?

Dynamic programming works for the knapsack problem by leveraging optimal substructure and overlapping subproblems. You define specific states and transitions to systematically evaluate decisions and maximize the objective value.

What are the limitations of dynamic programming for algorithm design?

Dynamic programming is limited to problems exhibiting optimal substructure and overlapping subproblems. It requires rigorous state definitions and complexity reasoning, making it unsuitable for problems lacking these specific mathematical properties.