Dynamic programming is an AI agent skill from the GitHub repository rnavarych/alpha-engineer. Solves optimization problems using dynamic programming — top-down memoization, bottom-up tabulation, state space design, dimension reduction, bitmask DP, interval DP, tree DP (with rerooting), DP on DAGs, and convex hull trick / divide-and-conquer optimizations. Use when solving optimization problem
Applying bitmask DP for small subset enumeration (n ≤ 20)
Optimizing O(n²) DP transitions with convex hull trick or D&C optimization
Core principles
State captures everything — if future decisions need more information, the state is incomplete
Bottom-up for production — no stack overflow, easier space optimization, predictable memory access
Rolling array before adding a dimension — space optimization is almost always possible
Bitmask DP is exact exponential, not a hack — O(2^n × n) is acceptable for n ≤ 20
Identify the DAG — every DP is a shortest/longest path on a state DAG; if you can draw it, you can implement it
Reference Files
references/identification-and-approach.md — DP recognition heuristics, top-down vs bottom-up trade-offs, state variable design, state compression, redundant state elimination
references/advanced-techniques.md — bitmask DP (TSP, assignment), tree DP with rerooting, DP on DAGs, convex hull trick, D&C optimization, rolling arrays, dimension reduction, implementation checklist
Use this skill with your AI agent:Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.