题库chevron_right解题模式chevron_right回溯·pruning
schema可复用解题模式

回溯·pruning模式

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

database52 道题tune2/34/16 难度梯度category6 个关联题型

模式摘要

先识别什么

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

解法节奏

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

高频失分点

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

识别信号

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

解题流程

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

常见失分点

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

推荐题单梯度

题库

回溯·pruning模式题库

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

慢加载模式题库

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

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

当前展示 24 / 52 道题目

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

电话号码的字母组合

Generate all letter combinations a digit string can represent using backtracking with pruning, leveraging hash table map…

中等
39

组合总和

Find all unique combinations of numbers from a distinct array that sum to a target using controlled backtracking search.

中等
40

组合总和 II

Find all unique combinations of numbers that sum to a target using backtracking with careful pruning to avoid duplicates…

中等
46

全排列

Generate all possible orderings of a distinct integer array using backtracking search with careful pruning to avoid dupl…

中等
47

全排列 II

Generate all unique permutations of an array containing duplicates using backtracking and pruning to avoid repeated sequ…

中等
51

N 皇后

Solve the N-Queens problem using backtracking with pruning, exploring all valid board placements while avoiding conflict…

困难
52

N 皇后 II

Solve the N-Queens II problem using backtracking with pruning to efficiently count all valid placements for n queens on …

困难
77

组合

Generate all combinations of k numbers from the range [1, n] using backtracking and pruning.

中等
78

子集

Generate all subsets of a set of unique integers using backtracking with pruning to avoid duplicates.

中等
79

单词搜索

Solve Word Search with backtracking by exploring adjacent cells to match a target word in a grid.

中等
89

格雷编码

Generate an n-bit Gray Code sequence using backtracking with pruning and bit manipulation techniques.

中等
90

子集 II

Subsets II problem asks to generate unique subsets from an array with possible duplicates using backtracking search with…

中等
93

复原 IP 地址

Restore all valid IP addresses from a string using backtracking with pruning, avoiding invalid segments or leading zeros…

中等
126

单词接龙 II

Find all shortest transformation sequences from beginWord to endWord using a dictionary, leveraging backtracking search …

困难
212

单词搜索 II

Solve the Word Search II problem using backtracking with pruning to find all words on a board of characters.

困难
216

组合总和 III

Find all unique combinations of k numbers adding to n using efficient backtracking with pruning in arrays.

中等
282

给表达式添加运算符

Expression Add Operators is solved with backtracking that builds multi-digit operands and tracks multiplication preceden…

困难
301

删除无效的括号

Remove the minimum number of invalid parentheses to generate all possible valid strings efficiently using backtracking a…

困难
306

累加数

Additive Number is solved by trying the first two splits, then pruning aggressively while verifying each required sum in…

中等
401

二进制手表

Binary Watch involves generating possible times on a binary watch given a number of turned-on LEDs.

简单
679

24 点游戏

Solve the 24 Game by arranging four card numbers using arithmetic operators and parentheses to reach exactly 24 efficien…

困难
784

字母大小写全排列

Letter Case Permutation involves generating all possible strings by changing the case of each letter in a given string.

中等
816

模糊坐标

Find all valid 2D coordinate possibilities for an ambiguous input string using backtracking and pruning techniques.

中等
842

将数组拆分成斐波那契序列

This problem challenges you to split a string into a Fibonacci-like sequence using backtracking and pruning.

中等

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

按题型继续深入

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

route

引导式练习路径

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

开始引导练习arrow_forward
LeetCode 回溯·pruning模式题解:52题训练路线