题库chevron_right解题模式chevron_right状态·转移·动态规划
schema可复用解题模式

状态·转移·动态规划模式

模式页更适合建立可迁移的解题框架。先抓识别信号,再反复练状态定义、更新规则和边界解释,能比零散刷题更快形成稳定手感。

database454 道题tune12/219/223 难度梯度category6 个关联题型

模式摘要

先识别什么

题目里常出现可以复用的状态更新节奏。

解法节奏

先口述状态和不变量,再解释每一步如何更新,最后用反例验证边界。

高频失分点

状态定义说不清,写出来也难以稳定维护。

识别信号

  • 题目里常出现可以复用的状态更新节奏。
  • 暴力枚举太慢,但结构上存在可维护的不变量。
  • 面试追问通常会盯住边界、状态变更和复杂度。

解题流程

  1. 1. 明确窗口/状态定义
  2. 2. 更新状态并维护约束
  3. 3. 用边界样例验证

常见失分点

  • 状态定义说不清,写出来也难以稳定维护。
  • 只会背模板,解释不了为什么这样更新。
  • 样例能过,但边界和复杂度追问容易崩。

推荐题单梯度

题库

状态·转移·动态规划模式题库

这里更适合先按关键词或难度找题,再按关联题型切入。题库会在容器内继续滚动时慢慢续载,避免模式页被长列表一下子拉穿。

慢加载模式题库

适合先建模式理解,再扩展到完整题单。

hourglass_bottom容器内滚动续载
search
tune难度
category题型聚焦

当前展示 24 / 454 道题目

每次续载 24 题
#题目难度
5

最长回文子串

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

中等
10

正则表达式匹配

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

困难
22

括号生成

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

中等
32

最长有效括号

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

困难
42

接雨水

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

困难
44

通配符匹配

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

困难
45

跳跃游戏 II

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

中等
53

最大子数组和

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

中等
55

跳跃游戏

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

中等
62

不同路径

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

中等
63

不同路径 II

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

中等
64

最小路径和

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

中等
70

爬楼梯

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

简单
72

编辑距离

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

中等
85

最大矩形

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

困难
87

扰乱字符串

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

困难
91

解码方法

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

中等
97

交错字符串

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

中等
115

不同的子序列

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

困难
118

杨辉三角

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

简单
119

杨辉三角 II

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

简单
120

三角形最小路径和

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

中等
121

买卖股票的最佳时机

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

简单
122

买卖股票的最佳时机 II

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

中等

swap_vert在题库框内继续向下滚动,也会自动续载

按题型继续深入

模式学会之后,最好回到具体题型里做迁移训练。这样更容易分清楚“模式本身”和“场景变化”分别在哪里。

route

引导式练习路径

AI 会按你的当前水平推荐题目,并持续记录练习进度。

开始引导练习arrow_forward
LeetCode 状态·转移·动态规划模式题解:454题训练路线