# Breadth-First Search DSA Problems

> 245 Breadth-First Search coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/breadth-first-search
Last updated: 2026-11-28

245 breadth-first search problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 245: 20 easy, 12 medium and 68 hard. Practise them free on InternHack and track what you have solved.

## Breadth-First Search problems, easiest first

1. [Average of Levels in Binary Tree](https://www.internhack.in/learn/dsa/problem/average-of-levels-in-binary-tree) (Easy)
2. [Cousins in Binary Tree](https://www.internhack.in/learn/dsa/problem/cousins-in-binary-tree) (Easy)
3. [Find a Corresponding Node of a Binary Tree in a Clone of That Tree](https://www.internhack.in/learn/dsa/problem/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree) (Easy)
4. [Find All The Lonely Nodes](https://www.internhack.in/learn/dsa/problem/find-all-the-lonely-nodes) (Easy)
5. [Find if Path Exists in Graph](https://www.internhack.in/learn/dsa/problem/find-if-path-exists-in-graph) (Easy)
6. [Flood Fill](https://www.internhack.in/learn/dsa/problem/flood-fill) (Easy)
7. [Invert Binary Tree](https://www.internhack.in/learn/dsa/problem/invert-binary-tree) (Easy)
8. [Island Perimeter](https://www.internhack.in/learn/dsa/problem/island-perimeter) (Easy)
9. [Maximum Depth of Binary Tree](https://www.internhack.in/learn/dsa/problem/maximum-depth-of-binary-tree) (Easy)
10. [Maximum Depth of N-ary Tree](https://www.internhack.in/learn/dsa/problem/maximum-depth-of-n-ary-tree) (Easy)
11. [Merge Two Binary Trees](https://www.internhack.in/learn/dsa/problem/merge-two-binary-trees) (Easy)
12. [Minimum Absolute Difference in BST](https://www.internhack.in/learn/dsa/problem/minimum-absolute-difference-in-bst) (Easy)
13. [Minimum Depth of Binary Tree](https://www.internhack.in/learn/dsa/problem/minimum-depth-of-binary-tree) (Easy)
14. [Minimum Distance Between BST Nodes](https://www.internhack.in/learn/dsa/problem/minimum-distance-between-bst-nodes) (Easy)
15. [Path Sum](https://www.internhack.in/learn/dsa/problem/path-sum) (Easy)
16. [Same Tree](https://www.internhack.in/learn/dsa/problem/same-tree) (Easy)
17. [Sum of Left Leaves](https://www.internhack.in/learn/dsa/problem/sum-of-left-leaves) (Easy)
18. [Symmetric Tree](https://www.internhack.in/learn/dsa/problem/symmetric-tree) (Easy)
19. [Two Sum IV - Input is a BST](https://www.internhack.in/learn/dsa/problem/two-sum-iv-input-is-a-bst) (Easy)
20. [Univalued Binary Tree](https://www.internhack.in/learn/dsa/problem/univalued-binary-tree) (Easy)
21. [01 Matrix](https://www.internhack.in/learn/dsa/problem/01-matrix) (Medium)
22. [Accounts Merge](https://www.internhack.in/learn/dsa/problem/accounts-merge) (Medium)
23. [Add One Row to Tree](https://www.internhack.in/learn/dsa/problem/add-one-row-to-tree) (Medium)
24. [All Ancestors of a Node in a Directed Acyclic Graph](https://www.internhack.in/learn/dsa/problem/all-ancestors-of-a-node-in-a-directed-acyclic-graph) (Medium)
25. [All Nodes Distance K in Binary Tree](https://www.internhack.in/learn/dsa/problem/all-nodes-distance-k-in-binary-tree) (Medium)
26. [All Paths From Source to Target](https://www.internhack.in/learn/dsa/problem/all-paths-from-source-to-target) (Medium)
27. [Amount of Time for Binary Tree to Be Infected](https://www.internhack.in/learn/dsa/problem/amount-of-time-for-binary-tree-to-be-infected) (Medium)
28. [Apply Substitutions](https://www.internhack.in/learn/dsa/problem/apply-substitutions) (Medium)
29. [As Far from Land as Possible](https://www.internhack.in/learn/dsa/problem/as-far-from-land-as-possible) (Medium)
30. [Binary Tree Level Order Traversal](https://www.internhack.in/learn/dsa/problem/binary-tree-level-order-traversal) (Medium)
31. [Binary Tree Level Order Traversal II](https://www.internhack.in/learn/dsa/problem/binary-tree-level-order-traversal-ii) (Medium)
32. [Binary Tree Right Side View](https://www.internhack.in/learn/dsa/problem/binary-tree-right-side-view) (Medium)
33. [Alien Dictionary](https://www.internhack.in/learn/dsa/problem/alien-dictionary) (Hard)
34. [Brace Expansion II](https://www.internhack.in/learn/dsa/problem/brace-expansion-ii) (Hard)
35. [Bus Routes](https://www.internhack.in/learn/dsa/problem/bus-routes) (Hard)
36. [Check if the Rectangle Corner Is Reachable](https://www.internhack.in/learn/dsa/problem/check-if-the-rectangle-corner-is-reachable) (Hard)
37. [Closest Node to Path in Tree](https://www.internhack.in/learn/dsa/problem/closest-node-to-path-in-tree) (Hard)
38. [Contain Virus](https://www.internhack.in/learn/dsa/problem/contain-virus) (Hard)
39. [Couples Holding Hands](https://www.internhack.in/learn/dsa/problem/couples-holding-hands) (Hard)
40. [Cut Off Trees for Golf Event](https://www.internhack.in/learn/dsa/problem/cut-off-trees-for-golf-event) (Hard)
41. [Distance to a Cycle in Undirected Graph](https://www.internhack.in/learn/dsa/problem/distance-to-a-cycle-in-undirected-graph) (Hard)
42. [Divide Nodes Into the Maximum Number of Groups](https://www.internhack.in/learn/dsa/problem/divide-nodes-into-the-maximum-number-of-groups) (Hard)
43. [Escape a Large Maze](https://www.internhack.in/learn/dsa/problem/escape-a-large-maze) (Hard)
44. [Escape the Spreading Fire](https://www.internhack.in/learn/dsa/problem/escape-the-spreading-fire) (Hard)
45. [Find All People With Secret](https://www.internhack.in/learn/dsa/problem/find-all-people-with-secret) (Hard)
46. [Find Edges in Shortest Paths](https://www.internhack.in/learn/dsa/problem/find-edges-in-shortest-paths) (Hard)
47. [Find Minimum Diameter After Merging Two Trees](https://www.internhack.in/learn/dsa/problem/find-minimum-diameter-after-merging-two-trees) (Hard)
48. [Freedom Trail](https://www.internhack.in/learn/dsa/problem/freedom-trail) (Hard)
49. [Frog Position After T Seconds](https://www.internhack.in/learn/dsa/problem/frog-position-after-t-seconds) (Hard)
50. [Height of Binary Tree After Subtree Removal Queries](https://www.internhack.in/learn/dsa/problem/height-of-binary-tree-after-subtree-removal-queries) (Hard)
51. [Jump Game IV](https://www.internhack.in/learn/dsa/problem/jump-game-iv) (Hard)
52. [K-Similar Strings](https://www.internhack.in/learn/dsa/problem/k-similar-strings) (Hard)
53. [Kth Ancestor of a Tree Node](https://www.internhack.in/learn/dsa/problem/kth-ancestor-of-a-tree-node) (Hard)
54. [Last Day Where You Can Still Cross](https://www.internhack.in/learn/dsa/problem/last-day-where-you-can-still-cross) (Hard)
55. [Longest Cycle in a Graph](https://www.internhack.in/learn/dsa/problem/longest-cycle-in-a-graph) (Hard)
56. [Longest Increasing Path in a Matrix](https://www.internhack.in/learn/dsa/problem/longest-increasing-path-in-a-matrix) (Hard)
57. [Making A Large Island](https://www.internhack.in/learn/dsa/problem/making-a-large-island) (Hard)
58. [Maximize the Number of Target Nodes After Connecting Trees II](https://www.internhack.in/learn/dsa/problem/maximize-the-number-of-target-nodes-after-connecting-trees-ii) (Hard)
59. [Maximum Candies You Can Get from Boxes](https://www.internhack.in/learn/dsa/problem/maximum-candies-you-can-get-from-boxes) (Hard)
60. [Maximum Number of Moves to Kill All Pawns](https://www.internhack.in/learn/dsa/problem/maximum-number-of-moves-to-kill-all-pawns) (Hard)
61. [Maximum Number of Points From Grid Queries](https://www.internhack.in/learn/dsa/problem/maximum-number-of-points-from-grid-queries) (Hard)
62. [Maximum Partition Factor](https://www.internhack.in/learn/dsa/problem/maximum-partition-factor) (Hard)
63. [Minimize Malware Spread](https://www.internhack.in/learn/dsa/problem/minimize-malware-spread) (Hard)
64. [Minimize Malware Spread II](https://www.internhack.in/learn/dsa/problem/minimize-malware-spread-ii) (Hard)
65. [Minimum Cost to Make at Least One Valid Path in a Grid](https://www.internhack.in/learn/dsa/problem/minimum-cost-to-make-at-least-one-valid-path-in-a-grid) (Hard)
66. [Minimum Edge Reversals So Every Node Is Reachable](https://www.internhack.in/learn/dsa/problem/minimum-edge-reversals-so-every-node-is-reachable) (Hard)
67. [Minimum Moves to Move a Box to Their Target Location](https://www.internhack.in/learn/dsa/problem/minimum-moves-to-move-a-box-to-their-target-location) (Hard)
68. [Minimum Moves to Reach Target with Rotations](https://www.internhack.in/learn/dsa/problem/minimum-moves-to-reach-target-with-rotations) (Hard)
69. [Minimum Number of Days to Disconnect Island](https://www.internhack.in/learn/dsa/problem/minimum-number-of-days-to-disconnect-island) (Hard)
70. [Minimum Number of Flips to Convert Binary Matrix to Zero Matrix](https://www.internhack.in/learn/dsa/problem/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix) (Hard)
71. [Minimum Number of Visited Cells in a Grid](https://www.internhack.in/learn/dsa/problem/minimum-number-of-visited-cells-in-a-grid) (Hard)
72. [Minimum Obstacle Removal to Reach Corner](https://www.internhack.in/learn/dsa/problem/minimum-obstacle-removal-to-reach-corner) (Hard)
73. [Minimum Operations to Equalize Binary String](https://www.internhack.in/learn/dsa/problem/minimum-operations-to-equalize-binary-string) (Hard)
74. [Minimum Reverse Operations](https://www.internhack.in/learn/dsa/problem/minimum-reverse-operations) (Hard)
75. [Minimum Runes to Add to Cast Spell](https://www.internhack.in/learn/dsa/problem/minimum-runes-to-add-to-cast-spell) (Hard)
76. [Minimum Time Takes to Reach Destination Without Drowning](https://www.internhack.in/learn/dsa/problem/minimum-time-takes-to-reach-destination-without-drowning) (Hard)
77. [Minimum Time to Visit a Cell In a Grid](https://www.internhack.in/learn/dsa/problem/minimum-time-to-visit-a-cell-in-a-grid) (Hard)
78. [Number of Distinct Islands II](https://www.internhack.in/learn/dsa/problem/number-of-distinct-islands-ii) (Hard)
79. [Number of Increasing Paths in a Grid](https://www.internhack.in/learn/dsa/problem/number-of-increasing-paths-in-a-grid) (Hard)
80. [Redundant Connection II](https://www.internhack.in/learn/dsa/problem/redundant-connection-ii) (Hard)
81. [Remove Invalid Parentheses](https://www.internhack.in/learn/dsa/problem/remove-invalid-parentheses) (Hard)
82. [Second Minimum Time to Reach Destination](https://www.internhack.in/learn/dsa/problem/second-minimum-time-to-reach-destination) (Hard)
83. [Serialize and Deserialize Binary Tree](https://www.internhack.in/learn/dsa/problem/serialize-and-deserialize-binary-tree) (Hard)
84. [Serialize and Deserialize N-ary Tree](https://www.internhack.in/learn/dsa/problem/serialize-and-deserialize-n-ary-tree) (Hard)
85. [Shortest Cycle in a Graph](https://www.internhack.in/learn/dsa/problem/shortest-cycle-in-a-graph) (Hard)
86. [Shortest Distance from All Buildings](https://www.internhack.in/learn/dsa/problem/shortest-distance-from-all-buildings) (Hard)
87. [Shortest Path in a Grid with Obstacles Elimination](https://www.internhack.in/learn/dsa/problem/shortest-path-in-a-grid-with-obstacles-elimination) (Hard)
88. [Shortest Path to Get All Keys](https://www.internhack.in/learn/dsa/problem/shortest-path-to-get-all-keys) (Hard)
89. [Shortest Path Visiting All Nodes](https://www.internhack.in/learn/dsa/problem/shortest-path-visiting-all-nodes) (Hard)
90. [Similar String Groups](https://www.internhack.in/learn/dsa/problem/similar-string-groups) (Hard)
91. [Sliding Puzzle](https://www.internhack.in/learn/dsa/problem/sliding-puzzle) (Hard)
92. [Smallest Rectangle Enclosing Black Pixels](https://www.internhack.in/learn/dsa/problem/smallest-rectangle-enclosing-black-pixels) (Hard)
93. [Sort Items by Groups Respecting Dependencies](https://www.internhack.in/learn/dsa/problem/sort-items-by-groups-respecting-dependencies) (Hard)
94. [Swim in Rising Water](https://www.internhack.in/learn/dsa/problem/swim-in-rising-water) (Hard)
95. [The Maze III](https://www.internhack.in/learn/dsa/problem/the-maze-iii) (Hard)
96. [Trapping Rain Water II](https://www.internhack.in/learn/dsa/problem/trapping-rain-water-ii) (Hard)
97. [Vertical Order Traversal of a Binary Tree](https://www.internhack.in/learn/dsa/problem/vertical-order-traversal-of-a-binary-tree) (Hard)
98. [Word Ladder](https://www.internhack.in/learn/dsa/problem/word-ladder) (Hard)
99. [Word Ladder II](https://www.internhack.in/learn/dsa/problem/word-ladder-ii) (Hard)
100. [Zuma Game](https://www.internhack.in/learn/dsa/problem/zuma-game) (Hard)

## Companies that ask breadth-first search problems

- [Google](https://www.internhack.in/learn/dsa/companies/google): 83 of these problems
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 68 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 52 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 48 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 38 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 28 of these problems
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok): 21 of these problems
- [Oracle](https://www.internhack.in/learn/dsa/companies/oracle): 20 of these problems
- [Apple](https://www.internhack.in/learn/dsa/companies/apple): 18 of these problems
- [Linkedin](https://www.internhack.in/learn/dsa/companies/linkedin): 13 of these problems
- [Adobe](https://www.internhack.in/learn/dsa/companies/adobe): 12 of these problems
- [Phonepe](https://www.internhack.in/learn/dsa/companies/phonepe): 11 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Two Pointers](https://www.internhack.in/learn/dsa/two-pointers) (217)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)
- [Stack](https://www.internhack.in/learn/dsa/stack) (167)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
