面试场景
高频考察问题建模、边界条件与口头表达的清晰度。
常见误区
只背模板不解释为什么,容易在追问里失分。
练习策略
每轮练 3-5 题,固定复盘复杂度和可替代解法。
推荐练习顺序
题库
二叉树 题库
先展示一段最适合快速浏览的题目列表,继续滚动时再慢慢续载,避免专题页被长列表一下子拉穿。
慢加载专题题库
适合这类题很多的专题,先扫结构,再逐步深入。
当前展示 24 / 130 道题目
每次续载 24 题二叉树的中序遍历
Binary Tree Inorder Traversal asks you to visit left subtree, node, then right subtree without losing position while mov…
不同的二叉搜索树 II
Generate all structurally unique BSTs with values 1 to n using backtracking and recursive tree construction techniques.
不同的二叉搜索树
Given n nodes, calculate the number of unique binary search trees (BSTs) that can be formed with values from 1 to n.
验证二叉搜索树
Validate Binary Search Tree problem checks if a binary tree satisfies BST properties using tree traversal and state trac…
恢复二叉搜索树
Recover a BST where two nodes are swapped by mistake using in-order traversal and careful state tracking to restore corr…
相同的树
Check whether two binary trees are identical by comparing structure and node values using DFS or BFS traversal strategie…
对称二叉树
Determine if a binary tree is symmetric by comparing left and right subtrees using DFS or BFS traversal techniques effic…
二叉树的层序遍历
Perform a level order traversal on a binary tree using BFS to return node values level by level.
二叉树的锯齿形层序遍历
Traverse a binary tree in zigzag level order, alternating directions at each depth using BFS and state tracking techniqu…
二叉树的最大深度
Find the maximum depth of a binary tree using traversal techniques to track the longest path from root to leaf.
从前序与中序遍历序列构造二叉树
Construct a binary tree using preorder and inorder traversal arrays, leveraging array scanning and hash table lookups.
从中序与后序遍历序列构造二叉树
Reconstruct a binary tree from given inorder and postorder arrays using array scanning and hash lookup to optimize recur…
二叉树的层序遍历 II
Return a bottom-up level order traversal of a binary tree, processing nodes left to right while tracking each level accu…
将有序数组转换为二叉搜索树
Pick the middle element as root at each step so the sorted array becomes a height-balanced BST with valid ordering.
有序链表转换二叉搜索树
Convert a sorted singly linked list into a height-balanced BST using pointer manipulation and divide-and-conquer recursi…
平衡二叉树
Determine if a binary tree is height-balanced using tree traversal and state tracking techniques.
二叉树的最小深度
Find the minimum depth of a binary tree, which is the shortest path from the root node to the nearest leaf node.
路径总和
Determine if a binary tree has a root-to-leaf path where the sum of node values equals a given target sum, using DFS or …
路径总和 II
Find all root-to-leaf paths in a binary tree where the sum of node values equals a given target using DFS backtracking.
二叉树展开为链表
Flatten a binary tree into a right-skewed linked list by manipulating pointers following a pre-order traversal, handling…
填充每个节点的下一个右侧节点指针
Connect each node across every level by reusing established next links to traverse a perfect binary tree without extra q…
填充每个节点的下一个右侧节点指针 II
Populate each next pointer in a binary tree to its immediate right node, handling nulls and uneven levels efficiently us…
二叉树中的最大路径和
Calculate the maximum sum of any path in a binary tree by exploring all node sequences using DFS and dynamic programming…
求根节点到叶节点数字之和
Calculate the sum of all root-to-leaf numbers in a binary tree where each path represents a number.
swap_vert在题库框内继续向下滚动,也会自动续载