题库chevron_right分类chevron_right广度优先搜索
arrow_outward

广度优先搜索

197 道题目
简单: 19中等: 122困难: 56

广度优先搜索 是技术面试里最常出现的能力维度之一。建议先掌握基础题型的边界处理,再逐步过渡到模式识别和复杂度 trade-off。

面试场景

高频考察问题建模、边界条件与口头表达的清晰度。

常见误区

只背模板不解释为什么,容易在追问里失分。

练习策略

每轮练 3-5 题,固定复盘复杂度和可替代解法。

推荐练习顺序

#题目难度
100

相同的树

Check whether two binary trees are identical by comparing structure and node values using DFS or BFS traversal strategie…

简单
101

对称二叉树

Determine if a binary tree is symmetric by comparing left and right subtrees using DFS or BFS traversal techniques effic…

简单
102

二叉树的层序遍历

Perform a level order traversal on a binary tree using BFS to return node values level by level.

中等
103

二叉树的锯齿形层序遍历

Traverse a binary tree in zigzag level order, alternating directions at each depth using BFS and state tracking techniqu…

中等
104

二叉树的最大深度

Find the maximum depth of a binary tree using traversal techniques to track the longest path from root to leaf.

简单
107

二叉树的层序遍历 II

Return a bottom-up level order traversal of a binary tree, processing nodes left to right while tracking each level accu…

中等
111

二叉树的最小深度

Find the minimum depth of a binary tree, which is the shortest path from the root node to the nearest leaf node.

简单
112

路径总和

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 …

简单
116

填充每个节点的下一个右侧节点指针

Connect each node across every level by reusing established next links to traverse a perfect binary tree without extra q…

中等
117

填充每个节点的下一个右侧节点指针 II

Populate each next pointer in a binary tree to its immediate right node, handling nulls and uneven levels efficiently us…

中等
126

单词接龙 II

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

困难
127

单词接龙

Find the shortest transformation sequence from a start word to an end word, with each word in the sequence differing by …

困难
130

被围绕的区域

Transform the matrix in-place by marking regions surrounded by 'X' as 'X', while keeping border-adjacent 'O's intact.

中等
133

克隆图

Clone Graph involves cloning a graph using DFS, focusing on graph traversal and neighbor management using hash tables.

中等
199

二叉树的右视图

The Binary Tree Right Side View problem asks you to return the visible nodes from the right side of a binary tree, trave…

中等
200

岛屿数量

Count the number of distinct islands in a binary grid using array traversal combined with depth-first search exploration…

中等
207

课程表

Determine if all courses can be completed by analyzing prerequisite dependencies using indegree tracking and topological…

中等
210

课程表 II

Solve the 'Course Schedule II' problem using graph indegree and topological ordering, utilizing DFS or BFS to find the c…

中等
226

翻转二叉树

Invert Binary Tree swaps every node's left and right children using tree traversal, with recursive DFS or iterative BFS …

简单
279

完全平方数

Perfect Squares asks for the least number of perfect squares summing to a given integer n using dynamic programming or B…

中等
297

二叉树的序列化与反序列化

This problem asks to serialize and deserialize a binary tree, requiring an efficient approach to handle traversal and st…

困难
301

删除无效的括号

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

困难
310

最小高度树

Identify all roots of a tree that produce minimum height using graph indegree analysis and topological trimming.

中等
322

零钱兑换

Find the minimum number of coins needed to reach a target amount using dynamic programming state transitions efficiently…

中等
329

矩阵中的最长递增路径

Find the length of the longest increasing path in a matrix with given movement constraints using graph techniques.

困难
365

水壶问题

Determine if two jugs with given capacities can measure an exact target amount using math and DFS strategies efficiently…

中等
399

除法求值

Compute the results of division queries from given equations using graph traversal and depth-first search efficiently.

中等
404

左叶子之和

Compute the total of all left leaves in a binary tree using precise traversal and state tracking techniques for correctn…

简单
407

接雨水 II

Solve Trapping Rain Water II using breadth-first search and priority queues for efficient water trapping in a matrix.

困难
417

太平洋大西洋水流问题

Find all cells on an island where water can flow to both the Pacific and Atlantic oceans using DFS or BFS.

中等
429

N 叉树的层序遍历

Perform a level order traversal on an n-ary tree, capturing nodes by depth using breadth-first search with careful state…

中等
433

最小基因变化

Determine the minimum number of single-character gene mutations to reach the target gene using BFS and a hash table look…

中等
449

序列化和反序列化二叉搜索树

Design an algorithm to serialize and deserialize a binary search tree with efficient traversal and state tracking.

中等
463

岛屿的周长

Determine the perimeter of an island in a grid of land and water cells using DFS or BFS.

简单
488

祖玛游戏

The Zuma Game involves clearing balls from the board using a limited hand, applying dynamic programming and state transi…

困难
513

找树左下角的值

Find the leftmost value in the last row of a binary tree using efficient traversal strategies.

中等
514

自由之路

Determine the minimum rotations and button presses to spell a keyword on a circular dial using state transition dynamic …

困难
515

在每个树行中找最大值

Find the largest value in each row of a binary tree using depth-first or breadth-first search techniques.

中等
529

扫雷游戏

Solve the Minesweeper game by updating revealed squares and handling clicks with Depth-First Search and Array manipulati…

中等
530

二叉搜索树的最小绝对差

Find the minimum absolute difference between values of any two nodes in a BST using tree traversal and careful state tra…

简单
542

01 矩阵

The '01 Matrix' problem challenges you to find the nearest zero for each cell in a binary matrix using dynamic programmi…

中等
547

省份数量

Solve Number of Provinces by scanning the adjacency matrix and launching DFS once per unvisited city component.

中等
559

N 叉树的最大深度

Find the maximum depth of an N-ary tree, leveraging tree traversal techniques and state tracking.

简单
617

合并二叉树

Merge Two Binary Trees requires combining nodes by summing overlapping values while preserving non-null nodes from eithe…

简单
623

在二叉树中增加一行

The problem requires adding a row of nodes to a binary tree at a specified depth.

中等
637

二叉树的层平均值

Calculate the average value of nodes on each level of a binary tree using traversal and state tracking.

简单
653

两数之和 IV - 输入二叉搜索树

Determine if a binary search tree contains two nodes whose values sum to a target using efficient traversal and state tr…

简单
655

输出二叉树

Print Binary Tree requires arranging a binary tree into a visually structured matrix using precise traversal and positio…

中等
662

二叉树最大宽度

Determine the maximum width of a binary tree by calculating the width of each level and considering the positions of the…

中等
672

灯泡开关 Ⅱ

Compute all unique bulb configurations after a fixed number of presses using math and bit manipulation efficiently.

中等
675

为高尔夫比赛砍树

Determine the minimum steps to cut all trees in a forest matrix in ascending height order using BFS traversal and priori…

困难
684

冗余连接

Identify and remove the redundant edge that causes a cycle in a graph starting as a tree.

中等
685

冗余连接 II

Find and remove the redundant connection in a directed graph that was originally a rooted tree.

困难
690

员工的重要性

Calculate an employee's total importance including all direct and indirect subordinates using array scanning and hash lo…

中等
695

岛屿的最大面积

Find the largest connected land area in a binary grid using array traversal and depth-first search efficiently.

中等
721

账户合并

Merge accounts by connecting emails and returning each user's sorted email list using array scanning and hash lookup eff…

中等
733

图像渲染

Flood Fill is an array and DFS problem where you change connected pixels to a target color efficiently using recursion o…

简单
743

网络延迟时间

Find the minimum time for a signal to travel to all nodes in a directed graph or determine if it's impossible.

中等
749

隔离病毒

Contain Virus involves using array-based Depth-First Search to contain viral spread by building walls around infected re…

困难
752

打开转盘锁

Solve the Open the Lock problem using array scanning plus hash lookup to efficiently find the shortest unlock sequence.

中等
756

金字塔转换矩阵

The Pyramid Transition Matrix problem requires determining whether a pyramid can be formed with given blocks and valid p…

中等
765

情侣牵手

This problem requires arranging couples sitting apart in a row with the minimum number of swaps using graph traversal an…

困难
773

滑动谜题

Determine the minimum moves to solve a 2x3 sliding puzzle using BFS and state transition dynamic programming techniques …

困难
778

水位上升的泳池中游泳

Solve the problem of swimming through a grid of rising water with a binary search on the valid answer space.

困难
783

二叉搜索树节点最小距离

Find the minimum difference between values of two different nodes in a Binary Search Tree using tree traversal and state…

简单
785

判断二分图

Determine whether an undirected graph can be split into two independent sets using DFS, BFS, or Union Find patterns.

中等
787

K 站中转内最便宜的航班

Find the cheapest flight from a source to a destination with at most K stops using graph traversal techniques efficientl…

中等
797

所有可能的路径

Find all paths in a directed acyclic graph (DAG) from source to target using depth-first search and backtracking.

中等
802

找到最终的安全状态

Solve the problem of finding eventual safe states in a directed graph using depth-first search and topological sorting.

中等
815

公交路线

Bus Routes is solved by BFS over buses and stops, using stop-to-route hashing to avoid expensive repeated route scans.

困难
827

最大人工岛

Calculate the largest island size by converting at most one zero in a binary grid using array and DFS techniques efficie…

困难
839

相似字符串组

Determine the number of connected groups of similar strings by swapping at most two letters using array scanning and has…

困难
841

钥匙和房间

Determine if all rooms can be visited given keys distributed across a set of interconnected locked rooms using graph tra…

中等
847

访问所有节点的最短路径

Solve the Shortest Path Visiting All Nodes problem by exploring dynamic programming, bit manipulation, and breadth-first…

困难
854

相似度为 K 的字符串

K-Similar Strings involves finding the minimal number of swaps to transform one string into another through character sw…

困难
863

二叉树中所有距离为 K 的结点

Find all nodes at distance K from a target node in a binary tree using various tree traversal techniques.

中等
864

获取所有钥匙的最短路径

Find the minimum steps to collect all keys in a grid using BFS and bitmasking, handling locks efficiently.

困难
865

具有所有最深节点的最小子树

Find the smallest subtree that contains all the deepest nodes in a binary tree.

中等
886

可能的二分法

Determine if a group of n people with mutual dislikes can be split into two non-conflicting groups using graph traversal…

中等
909

蛇梯棋

Solve the Snakes and Ladders problem using a BFS strategy to efficiently navigate the board and reach the final square.

中等
919

完全二叉树插入器

Implement a data structure to insert nodes into a complete binary tree while preserving its completeness efficiently.

中等
924

尽量减少恶意软件的传播

Identify which single infected node to remove to minimize total malware spread in a connected network graph efficiently.

困难
928

尽量减少恶意软件的传播 II

Minimize Malware Spread II asks to minimize the spread of malware in a network of nodes by removing one infected node.

困难
934

最短的桥

Find the minimum flips to connect two separate islands in a binary matrix using Array and DFS techniques efficiently.

中等
958

二叉树的完全性检验

Determine if a binary tree is complete by verifying its node structure and leftmost placement in the last level.

中等
959

由斜杠划分区域

Determine the number of regions in a grid divided by slashes using array scanning and union-find techniques efficiently.

中等
965

单值二叉树

Determine if a binary tree is uni-valued using traversal and state tracking techniques.

简单
967

连续差相同的数字

Generate all n-digit numbers where consecutive digits differ by k using efficient backtracking and BFS techniques.

中等
987

二叉树的垂序遍历

Perform a vertical order traversal of a binary tree, sorting nodes by their values within columns.

困难
993

二叉树的堂兄弟节点

Determine if two nodes in a binary tree are cousins by leveraging binary-tree traversal and state tracking.

简单
994

腐烂的橘子

Given a grid with fresh and rotten oranges, return the minimum time for all oranges to rot or -1 if impossible.

中等
1020

飞地的数量

This problem involves finding the number of land cells that cannot reach the boundary in a grid using DFS and array mani…

中等
1034

边界着色

Given a grid and a starting cell, color all border cells of the connected component using DFS while preserving interior …

中等
1036

逃离大迷宫

The 'Escape a Large Maze' problem involves navigating a massive grid with blocked squares and finding if a target can be…

困难
1042

不邻接植花

In this problem, you are tasked with planting flowers in gardens with specific constraints based on graph traversal prin…

中等
1091

二进制矩阵中的最短路径

Find the shortest clear path in a binary matrix using BFS, carefully handling obstacles and diagonal movements for effic…

中等
1096

花括号展开 II

Solve Brace Expansion II efficiently by using stack-based state management to generate all unique combinations of nested…

困难
1123

最深叶节点的最近公共祖先

Find the lowest common ancestor of the deepest leaves in a binary tree using efficient traversal and state tracking tech…

中等
1129

颜色交替的最短路径

Solve the shortest path problem with alternating edge colors using graph traversal and BFS.

中等
1161

最大层内元素和

Find the level of a binary tree where the sum of its nodes is maximal, with an emphasis on binary-tree traversal.

中等
1162

地图分析

Find the farthest water cell from land in a grid and return the Manhattan distance using state transition dynamic progra…

中等
1202

交换字符串中的元素

Find the lexicographically smallest string by swapping characters in given pairs of indices.

中等
1203

项目管理

Sort items into groups while respecting dependencies using graph indegree tracking and topological ordering patterns eff…

困难
1210

穿过迷宫的最少移动次数

Find the minimum moves for a 2-cell snake to reach the bottom-right corner using rotations and BFS traversal in a grid.

困难
1254

统计封闭岛屿的数目

Count the number of closed islands in a 2D grid using array traversal and depth-first search efficiently.

中等
1261

在受污染的二叉树中查找元素

Recover values in a contaminated binary tree and efficiently check for existence using traversal and state tracking tech…

中等
1263

推箱子

Solve the minimum moves to push a box to its target using BFS and priority handling in a grid-based warehouse layout eff…

困难
1267

统计参与通信的服务器

Count Servers that Communicate involves identifying servers in a grid that can communicate based on row or column connec…

中等
1284

转化为全零矩阵的最少反转次数

Compute the minimum flips to convert a binary matrix to zero by toggling cells and neighbors using array scanning plus h…

困难
1293

网格中的最短路径

Find the shortest path in a grid with obstacles, allowing the elimination of up to k obstacles using BFS.

困难
1298

你能从盒子里获得的最大糖果数

Collect maximum candies from boxes by exploring initially available boxes and using keys to unlock additional ones effic…

困难
1302

层数最深叶子节点的和

Find the sum of the deepest leaves in a binary tree by using tree traversal and state tracking techniques.

中等
1306

跳跃游戏 III

Jump Game III challenges you to determine if you can reach any zero in an array using jumps defined by array values, tes…

中等
1311

获取你好友已观看的视频

Find videos watched by friends up to a given level and return them sorted by frequency and alphabetically.

中等
1315

祖父节点值为偶数的节点和

This problem involves calculating the sum of nodes with an even-valued grandparent in a binary tree.

中等
1319

连通网络的操作次数

Determine the minimum number of operations required to connect all computers in a network with a limited number of cable…

中等
1345

跳跃游戏 IV

Jump Game IV requires minimizing steps to reach the last index using jumps across equal values and neighbors efficiently…

困难
1361

验证二叉树

Validate Binary Tree Nodes problem requires checking if a set of nodes forms a valid binary tree using graph traversal.

中等
1368

使网格图至少有一条有效路径的最小代价

Determine the minimum cost to create at least one valid path from the top-left to bottom-right in a directional grid.

困难
1376

通知所有员工所需的时间

Calculate the time needed for the head of a company to inform all employees using tree traversal techniques.

中等
1377

T 秒后青蛙的位置

The problem asks for the probability that a frog reaches a target vertex after t seconds in a tree graph.

困难
1379

找出克隆二叉树中的相同节点

Find the corresponding node in a cloned binary tree using binary-tree traversal and state tracking.

简单
1391

检查网格中是否存在有效路径

Check if there is a valid path from the upper-left to the bottom-right corner of a grid using depth-first search.

中等
1443

收集树上所有苹果的最少时间

Minimize the time spent to collect all apples in a tree, considering traversal and state tracking with binary tree techn…

中等
1448

统计二叉树中好节点的数目

Count Good Nodes in Binary Tree identifies nodes exceeding all previous values along their path using DFS traversal tech…

中等
1457

二叉树中的伪回文路径

Count all root-to-leaf paths in a binary tree that can be rearranged to form a palindrome using bitwise state tracking.

中等
1462

课程表 IV

Determine if one course is a prerequisite of another using graph indegree tracking and topological ordering efficiently.

中等
1466

重新规划路线

Reorder Routes to Make All Paths Lead to the City Zero involves reversing the direction of roads in a tree to ensure all…

中等
1483

树节点的第 K 个祖先

Find the kth ancestor of any node in a tree using efficient binary-tree traversal and dynamic state tracking methods.

困难
1519

子树中标签相同的节点数

Compute the number of nodes in each subtree sharing the same label using DFS with hash table aggregation efficiently.

中等
1559

二维网格图中探测环

Detect cycles in a 2D character grid using DFS while carefully tracking parent cells to avoid invalid revisits.

中等
1568

使陆地分离的最少天数

Find the minimum number of days to disconnect an island in a grid using depth-first search.

困难
1609

奇偶树

Determine if a binary tree meets Even-Odd rules by checking value parity and strict ordering at each level efficiently.

中等
1625

执行操作后字典序最小的字符串

Optimize a string through rotations and additions to get the lexicographically smallest possible result using string man…

中等
1631

最小体力消耗路径

Find the minimum effort required to travel from the top-left to the bottom-right of a grid, considering height differenc…

中等
1654

到家的最少跳跃次数

Find the minimum number of jumps needed to reach a target position while avoiding forbidden positions.

中等
1765

地图中的最高点

Solve the Map of Highest Peak problem using breadth-first search to assign heights based on proximity to water cells.

中等
1905

统计子岛屿

Identify and count all islands in grid2 that are fully contained within islands of grid1 using DFS traversal efficiently…

中等
1926

迷宫中离入口最近的出口

Find the shortest path from the maze entrance to the nearest border exit using BFS over a 2D array matrix efficiently.

中等
1970

你能穿过矩阵的最后一天

Find the last day to walk from top to bottom in a flooded matrix by using binary search and graph traversal techniques.

困难
1971

寻找图中是否存在路径

Determine if a valid path exists between two vertices in a bi-directional graph using traversal techniques.

简单
1992

找到所有的农场组

Identify all rectangular farmland groups in a binary matrix using array traversal and depth-first search efficiently.

中等
1993

树上的操作

Design a tree data structure that allows locking, unlocking, and upgrading nodes with user-specific actions.

中等
2039

网络空闲的时刻

Calculate the time when the network becomes idle, factoring in message resending and the BFS traversal method.

中等
2045

到达目的地的第二短时间

Find the second minimum time to reach a destination using BFS while accounting for traffic signal delays in a graph trav…

困难
2059

转化数字的最小运算数

Determine the minimum operations needed to convert a number using array elements with addition, subtraction, or XOR oper…

中等
2092

找出知晓秘密的所有专家

Find all people who receive a secret through meetings using graph traversal with depth-first search efficiently and corr…

困难
2101

引爆最多的炸弹

Determine the maximum number of bombs that can be detonated by leveraging chain reactions using graph traversal and DFS …

中等
2146

价格范围内最高排名的 K 样物品

Use BFS to rank reachable shop items by distance, price, row, and column, then return the best k coordinates.

中等
2192

有向无环图中一个节点的所有祖先

Solve the All Ancestors of a Node in a Directed Acyclic Graph problem using graph traversal techniques like BFS, DFS, an…

中等
2258

逃离火灾

Maximize the time you can stay at your starting position before moving to safely reach the safehouse while avoiding fire…

困难
2290

到达角落需要移除障碍物的最小数目

Find the minimum obstacles to remove in a 2D grid to reach the bottom-right corner using BFS graph traversal techniques.

困难
2316

统计无向图中无法互相到达点对数

Calculate the total number of node pairs in an undirected graph that cannot reach each other using DFS, BFS, or Union Fi…

中等
2328

网格图中递增路径的数目

Solve Number of Increasing Paths in a Grid by turning cell comparisons into a DAG and counting paths with topological DP…

困难
2360

图中的最长环

The problem asks to find the longest cycle in a directed graph with specific edge constraints.

困难
2368

受限条件下可到达节点的数目

In the 'Reachable Nodes With Restrictions' problem, find the maximum reachable nodes from node 0 in a tree while avoidin…

中等
2385

感染二叉树需要的总时间

The problem asks to calculate the number of minutes for an infection to spread across all nodes in a binary tree startin…

中等
2415

反转二叉树的奇数层

Reverse the node values at each odd level in a perfect binary tree, preserving the even levels.

中等
2458

移除子树后的二叉树高度

Compute the height of a binary tree efficiently after removing subtrees, using traversal and precomputed node state trac…

困难
2467

树上最大得分和路径

Solve the 'Most Profitable Path in a Tree' problem using graph traversal and depth-first search techniques to maximize A…

中等
2471

逐层排序二叉树所需的最少操作数目

Determine the minimum number of swaps to sort each level of a binary tree using level-wise traversal efficiently.

中等
2477

到达首都的最少油耗

Calculate the minimum fuel needed for all city representatives to reach the capital using DFS on a tree graph efficientl…

中等
2492

两个城市间路径的最小分数

Find the minimum distance in a path connecting two cities using graph traversal strategies efficiently.

中等
2493

将节点分成尽可能多的组

Determine the maximum number of groups nodes can form in a graph using depth-first traversal without violating edge conn…

困难
2503

矩阵查询可获得的最大分数

Solve the Maximum Number of Points From Grid Queries problem using two-pointer scanning and invariant tracking.

困难
2556

二进制矩阵中翻转最多一次使路径不连通

Determine if a single cell flip can disconnect a path from the top-left to bottom-right in a binary matrix efficiently u…

中等
2577

在网格图中访问一个格子的最少时间

Compute the fastest path in a grid where each cell has a minimum time requirement using BFS and priority queue technique…

困难
2583

二叉树中的第 K 大层和

Find the kth largest level sum in a binary tree using level-order traversal and sorting.

中等
2596

检查骑士巡视方案

Validate a knight's movement configuration on an n x n chessboard to check if it forms a valid Knight's Tour.

中等
2608

图中的最短环

Find the shortest cycle in a bi-directional graph using BFS for optimal traversal.

困难
2612

最少翻转操作数

Find the minimum number of operations to move a 1 in an array from a given start position to other positions, considerin…

困难
2617

网格图中最少访问的格子数

Determine the minimum number of cells to visit in a grid using state transition dynamic programming and efficient traver…

困难
2641

二叉树的堂兄弟节点 II

Replace each node in a binary tree with the sum of all its cousins by carefully tracking depth and parent relationships.

中等
2658

网格图中鱼的最大数目

Maximize the number of fish that can be caught by performing DFS on an optimal starting point in a grid.

中等
2685

统计完全连通分量的数量

Determine the number of complete connected components in an undirected graph using efficient traversal techniques and gr…

中等
2812

找出最安全路径

Find the Safest Path in a Grid uses binary search and BFS to maximize path safeness from thieves in a grid.

中等
2850

将石头分散到网格图的最少移动次数

Solve the problem of distributing 9 stones across a 3x3 grid with minimal moves using state transition dynamic programmi…

中等
2858

可以到达每一个节点的最少边反转次数

This problem requires solving a graph traversal with edge reversals to ensure every node is reachable in a tree-like str…

困难
2998

使 X 和 Y 相等的最少操作次数

Determine the minimum operations to make two integers equal using increment, decrement, and division efficiently with DP…

中等
3015

按距离统计房屋对数目 I

Determine the number of house pairs at each street distance using graph traversal and breadth-first search efficiently.

中等
3123

最短路径中的边

Use two Dijkstra runs to mark exactly which edges can appear on at least one shortest path from 0 to n - 1.

困难
3203

合并两棵树后的最小直径

Calculate the minimum diameter after merging two trees by strategically connecting nodes to minimize the longest path in…

困难
3235

判断矩形的两个角落是否可达

Determine if there is a valid path from the bottom-left to top-right of a rectangle while avoiding circles.

困难
3243

新增道路查询后的最短距离 I

Solve shortest paths dynamically in a growing graph using BFS, updating distances efficiently after each road addition q…

中等
3283

吃掉所有兵需要的最多移动次数

Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…

困难
3286

穿越网格图的安全路径

Determine if you can safely traverse a binary grid from top-left to bottom-right using limited health points.

中等
3310

移除可疑的方法

Remove suspicious methods in a project that are invoked directly or indirectly from a buggy method using graph traversal…

中等
3372

连接两棵树后最大目标节点数目 I

Maximize the number of target nodes after connecting two trees using binary tree traversal and state tracking.

中等
3373

连接两棵树后最大目标节点数目 II

Maximize the number of target nodes after connecting two trees by analyzing their structure and target relationships.

困难
3387

两天自由外汇交易后的最大货币数

Compute the maximum currency amount after two days using graph traversal and depth-first search for optimal conversions.

中等
3419

图的最大边权的最小值

Minimize the maximum edge weight in a graph after removing certain edges while ensuring node reachability.

中等
3493

属性图

Find the number of connected components in an undirected graph formed by properties arrays, using array scanning and has…

中等
3528

单位转换 I

Solve the unit conversion problem by using graph traversal to compute equivalent unit amounts.

中等
3552

网格传送门旅游

Find the minimum moves to traverse a 2D grid using standard steps and one-time portal teleports efficiently.

中等
3568

清理教室的最少移动

Solve the "Minimum Moves to Clean the Classroom" problem using array scanning and hash lookup for an optimized solution.

中等
3607

电网维护

Determine which power stations remain connected after maintenance using array scanning and hash lookups to track compone…

中等
3619

总价值可以被 K 整除的岛屿数目

Count the number of islands in a grid where the sum of each island's values is divisible by a given integer k.

中等

关联高频模式

LeetCode 广度优先搜索题型题解:197题训练路线