面试场景
高频考察问题建模、边界条件与口头表达的清晰度。
常见误区
只背模板不解释为什么,容易在追问里失分。
练习策略
每轮练 3-5 题,固定复盘复杂度和可替代解法。
推荐练习顺序
爬楼梯
Climbing Stairs is a classic dynamic programming problem where you calculate distinct ways to reach the top using step t…
单词拆分
Determine if a string can be fully segmented into dictionary words using array scanning and hash-based lookups for effic…
单词拆分 II
Given a string and dictionary, return all possible sentences by adding spaces where each word is in the dictionary.
为运算表达式设计优先级
Solve Different Ways to Add Parentheses by splitting on each operator and memoizing every subexpression result list.
矩阵中的最长递增路径
Find the length of the longest increasing path in a matrix with given movement constraints using graph techniques.
整数替换
Find the minimum number of operations to reduce a number to 1 by applying specific operations, using state transition dy…
我能赢吗
Determine if the first player can guarantee a win in a turn-based number selection game using state transition dynamic p…
祖玛游戏
The Zuma Game involves clearing balls from the board using a limited hand, applying dynamic programming and state transi…
斐波那契数
Calculate the nth Fibonacci number using state transition dynamic programming and recursive techniques efficiently in in…
移除盒子
Maximize points by strategically removing contiguous same-colored boxes using state transition dynamic programming and m…
大礼包
Minimize the cost of purchasing items using available special offers with state transition dynamic programming.
贴纸拼词
Determine the minimum number of stickers needed to spell a target word using array scanning and hash lookups for efficie…
划分为k个相等的子集
Determine if an integer array can be partitioned into k subsets where each subset sums to the same value using DP and ba…
滑动谜题
Determine the minimum moves to solve a 2x3 sliding puzzle using BFS and state transition dynamic programming techniques …
所有可能的真二叉树
Generate all possible full binary trees with n nodes, focusing on dynamic programming and binary tree traversal.
猫和老鼠
Determine the outcome of a two-player Cat and Mouse game on a graph using topological ordering and memoized dynamic prog…
表示数字的最少运算符
Compute the minimum number of arithmetic operators to form a target using repeated x with addition, subtraction, multipl…
第 N 个泰波那契数
Compute the N-th Tribonacci number using state transition dynamic programming with careful memoization and iterative upd…
将整数按权重排序
Sort integers in a range based on their power value using dynamic programming and memoization, handling ties with ascend…
切披萨的方案数
This problem challenges you to determine the number of valid ways to cut a pizza into pieces with apples using dynamic p…
吃掉 N 个橘子的最少天数
Find the minimum number of days to eat n oranges using state transition dynamic programming with memoization.
将子数组重新排序得到同一个二叉搜索树的方案数
Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.
统计所有可行路径
This problem requires counting all possible routes between cities using fuel efficiently with state transition dynamic p…
使整数变为 0 的最少操作次数
Compute the minimum number of one-bit operations to convert a given integer to zero using state transition dynamic progr…
最大化网格幸福感
Maximize Grid Happiness is a dynamic programming problem focusing on state transitions with bitmasking to maximize happi…
猫和老鼠 II
Cat and Mouse II requires determining if the mouse can reach food before being caught using graph and topological orderi…
得到新鲜甜甜圈的最多组数
Reorder groups to maximize happy customers by using state transition dynamic programming with bitmasking for optimal bat…
有向图中最大颜色值
Compute the maximum color frequency along any valid path in a directed graph using topological ordering and dynamic prog…
最佳运动员的比拼回合
This problem requires finding the earliest and latest rounds where two players compete using dynamic programming with st…
解出数学表达式的学生分数
Calculate student scores for a single-digit math expression using state transition dynamic programming to track all vali…
小于等于 K 的最长二进制子序列
Find the longest subsequence in a binary string that forms a number less than or equal to a given integer k.
卖木头块
Maximize your profit by cutting a wooden piece into smaller parts based on given prices and dimensions.
不同骰子序列的数目
Calculate the number of distinct sequences of dice rolls based on specific conditions using dynamic programming.
网格图中递增路径的数目
Solve Number of Increasing Paths in a Grid by turning cell comparisons into a DAG and counting paths with topological DP…
矩阵中严格递增的单元格数
Find the maximum number of cells that can be visited in a matrix by following strictly increasing values from a starting…
有向图访问计数
Count Visited Nodes in a Directed Graph uses dynamic programming to solve graph traversal and node visitation counting e…
收集所有金币可获得的最大积分
Find the maximum points after collecting coins from all nodes of a tree using binary-tree traversal and state tracking.
使 X 和 Y 相等的最少操作次数
Determine the minimum operations to make two integers equal using increment, decrement, and division efficiently with DP…
相同分数的最大操作数目 II
This problem asks to maximize operations on an integer array where all deletions produce the same score using dynamic pr…
到达第 K 级台阶的方案数
Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…
最长 V 形对角线段的长度
Compute the maximum length of a V-shaped diagonal segment in a 2D integer matrix using state transition dynamic programm…