LeetCodechevron_rightSolve patternschevron_rightstate transition dp
schemaReusable solving pattern

state transition dp Pattern

Pattern hubs are for building transferable solving frames. Learn the recognition signals first, then drill state definition, update rules, and edge explanation until the pattern feels stable.

database454 problemstune12/219/223 difficulty mixcategory6 linked topics

Pattern brief

Recognize first

Do you identify both odd and even length palindromes during center expansion?

Solve rhythm

State the active state and invariant first, explain how each update preserves them, then pressure-test with counterexamples.

Most common miss

Forgetting to check even-length palindromes, which requires treating centers between characters.

Recognition signals

  • Do you identify both odd and even length palindromes during center expansion?
  • Can you explain how previously computed palindromes reduce redundant checks in the DP table?
  • Assess understanding of dynamic programming, especially with state transitions.

Solve flow

  1. 1. Define the active state/window.
  2. 2. Update state while preserving invariants.
  3. 3. Validate with edge-heavy examples.

Common misses

  • Forgetting to check even-length palindromes, which requires treating centers between characters.
  • Failing to handle edge cases like empty string `s` or pattern `p` properly.
  • Failing to properly balance the number of opening and closing parentheses during backtracking leads to invalid sequences.

Recommended Ladder

Problem bank

state transition dp pattern bank

Start by scanning with search or difficulty filters, then narrow by linked topics. The bank continues loading inside its own container so the page stays readable.

Progressive pattern bank

Use it to build pattern understanding first, then expand into the full corpus.

hourglass_bottomScroll inside to continue
search
tuneDifficulty
categoryTopic focus

Showing 24 / 454 problems

+24 per load
#TitleDifficulty
5

Longest Palindromic Substring

Find the longest contiguous palindromic substring in a given string using dynamic programming and two-pointer expansion …

Medium
10

Regular Expression Matching

The Regular Expression Matching problem involves checking if a string matches a pattern using '.' and '*'.

Hard
22

Generate Parentheses

Generate Parentheses requires generating all valid combinations of parentheses with given pairs using backtracking and s…

Medium
32

Longest Valid Parentheses

Compute the length of the longest well-formed parentheses substring using state transition dynamic programming and stack…

Hard
42

Trapping Rain Water

Calculate the total trapped rain water using the elevation map array, leveraging dynamic programming and two-pointer pat…

Hard
44

Wildcard Matching

Implement full wildcard pattern matching using '?' and '*' by applying state transition dynamic programming with careful…

Hard
45

Jump Game II

Jump Game II requires finding the minimum jumps to reach the end of an array using dynamic programming and greedy techni…

Medium
53

Maximum Subarray

Maximum Subarray is a classic state transition dynamic programming problem about deciding whether to extend or restart a…

Medium
55

Jump Game

Solve the Jump Game problem using state transition dynamic programming to determine if you can reach the last index of t…

Medium
62

Unique Paths

Calculate the number of unique paths for a robot to move on an m x n grid with only right and down movements.

Medium
63

Unique Paths II

Calculate the number of unique paths from top-left to bottom-right in a grid with obstacles using dynamic programming st…

Medium
64

Minimum Path Sum

Compute the minimum sum from top-left to bottom-right in a grid using state transition dynamic programming efficiently.

Medium
70

Climbing Stairs

Climbing Stairs is a classic dynamic programming problem where you calculate distinct ways to reach the top using step t…

Easy
72

Edit Distance

Determine the minimum number of insertions, deletions, or replacements to transform one string into another using dynami…

Medium
85

Maximal Rectangle

Compute the largest rectangle of 1's in a binary matrix using dynamic programming and stack-based state transitions effi…

Hard
87

Scramble String

Scramble String is a dynamic programming problem where we determine if one string can be scrambled to form another using…

Hard
91

Decode Ways

Decode Ways is a dynamic programming problem focused on decoding a numeric string to letters using specific mappings.

Medium
97

Interleaving String

The Interleaving String problem requires determining if a string can be formed by interleaving two others, utilizing dyn…

Medium
115

Distinct Subsequences

Compute the number of distinct subsequences of one string matching another using precise state transition dynamic progra…

Hard
118

Pascal's Triangle

Generate the first numRows of Pascal's Triangle using dynamic programming with clear state transitions and array manipul…

Easy
119

Pascal's Triangle II

Compute the specific row of Pascal's Triangle using efficient state transition dynamic programming with array-based upda…

Easy
120

Triangle

Given a triangle, return the minimum path sum from top to bottom, moving to adjacent numbers in the row below.

Medium
121

Best Time to Buy and Sell Stock

Maximize stock profit by identifying the optimal buy and sell days using dynamic programming.

Easy
122

Best Time to Buy and Sell Stock II

Maximize stock profit by using a greedy approach to buy and sell multiple times, with state transition dynamic programmi…

Medium

swap_vertScroll inside the bank to auto-load more

Continue by topic

Once the pattern itself feels familiar, move back into concrete topic hubs so you can separate the pattern from the changing problem context.

route

Guided Practice Path

AI recommends problems by your level and tracks your progress.

Start Guided Patharrow_forward
State transition dynamic programming LeetCode Pattern: 454 Solutions