GL
GrindLens
PatternsSheetsPricingQuestions
  1. Home
  2. /Patterns
  3. /State Machine DP
←All Patterns
Dynamic ProgrammingEvidence Contributing

State Machine DP

DP tracking which of several explicit states (e.g. holding/not-holding stock, in/out of cooldown) you're in at each step.

Practice Problems: 3
Difficulty: 0 Easy·1 Medium·2 Hard

Core technique

Review the technique, then try the mapped problems below. The right approach depends on each problem's constraints.

  • Core Strategy: DP tracking which of several explicit states (e.g. holding/not-holding stock, in/out of cooldown) you're in at each step.

Canonical Practice Problems

3 problems
1.Best Time to Buy and Sell Stock with CooldownMedium
Solve on LeetCode↗
2.Best Time to Buy and Sell Stock IIIHard
Solve on LeetCode↗
3.Best Time to Buy and Sell Stock IVHard
Solve on LeetCode↗

Curated Sheets Containing This Pattern

Striver A2Z

3 problems

→

LeetCode Top Interview 150

2 problems

→

NeetCode 150

1 problem

→

NeetCode All

1 problem

→

Related Algorithmic Patterns

Dynamic Programming

0/1 Knapsack

Dynamic Programming

Circular Array DP

Dynamic Programming

Expand Around Center

Dynamic Programming

Grid / 2D Path DP

Dynamic Programming

Interval DP

GL
GrindLens

Precision pattern analytics and curated sheet tracking for algorithmic coding interview preparation.

Quick lookup:⌘Kor/

Platform

  • Patterns→
  • Sheets→
  • Pricing→

Community

  • Feedback
  • Report a bug
  • X
  • LinkedIn

© 2026 GrindLens. LeetCode is a trademark of LeetCode. GrindLens is an independent analytics platform and is not affiliated with or endorsed by LeetCode.

Terms of ServicePrivacy Policy