All problems
› BFS problems
BFS problems
91 BFS DSA practice problems on CampusCode, each with statement, examples and constraints.
542. Swim in Rising Water
Hard
Binary Search
582. BFS Level Order Traversal Using Queue
Easy
Stack
607. Rotting Oranges — BFS via Queue
Easy
Stack
628. Open the Lock (BFS + Queue)
Medium
Stack
639. Walls and Gates
Medium
Stack
640. Shortest Path in Binary Matrix
Medium
Stack
641. Perfect Squares
Medium
Stack
642. As Far from Land as Possible
Medium
Stack
643. Map of Highest Peak
Medium
Stack
647. Snakes and Ladders
Medium
Stack
650. Minimum Number of Flips to Convert Binary Matrix to Zero
Medium
Stack
659. Remove Invalid Parentheses
Hard
Stack
672. Shortest Path in a Grid with Obstacles Elimination
Hard
Stack
673. Sliding Puzzle — Minimum Moves
Hard
Stack
674. Cut Off Trees for Golf Event
Hard
Stack
675. Minimum Genetic Mutation
Hard
Stack
676. Word Ladder — Shortest Transformation
Hard
Stack
685. Bus Routes
Hard
Stack
838. Level Order Traversal (BFS)
Easy
Trees
840. Minimum Depth of Binary Tree
Easy
Trees
852. Left View of Binary Tree
Easy
Trees
853. Right View of Binary Tree
Easy
Trees
854. Top View of Binary Tree
Easy
Trees
855. Bottom View of Binary Tree
Easy
Trees
856. Zigzag Level Order Traversal
Easy
Trees
858. Vertical Order Traversal
Easy
Trees
859. Check if Binary Tree is Complete
Easy
Trees
862. Find Maximum Width of Binary Tree
Easy
Trees
865. Print Nodes at Distance K from Root
Easy
Trees
866. Find Level of a Node in Binary Tree
Easy
Trees
867. Check if Leaf Nodes are at Same Level
Easy
Trees
871. Find the Deepest Left Leaf Node
Easy
Trees
872. Find Maximum Level Sum in Binary Tree
Easy
Trees
873. Connect Level Order Siblings (Next Pointer)
Easy
Trees
899. Populating Next Right Pointers in Each Node
Medium
Trees
900. Binary Tree Right Side View
Medium
Trees
905. All Nodes Distance K in Binary Tree
Medium
Trees
908. Time to Burn Binary Tree from a Node
Medium
Trees
934. Even Odd Tree
Medium
Trees
935. Check Completeness of a Binary Tree
Medium
Trees
940. Time to Burn Tree — Multi-Source BFS
Hard
Trees
974. BFS Traversal of Undirected Graph
Easy
Graphs
976. BFS Traversal of Directed Graph
Easy
Graphs
978. Find Shortest Path in Unweighted Graph
Easy
Graphs
980. Level of Each Node from Source
Easy
Graphs
982. Multi-Source BFS — Minimum Distance to Any Source
Easy
Graphs
983. Check if Graph is Bipartite
Easy
Graphs
986. Detect Cycle in Undirected Graph Using BFS
Easy
Graphs
990. Flood Fill Algorithm
Easy
Graphs
992. Count Islands Using BFS
Easy
Graphs
993. Surrounded Regions — Capture Os
Easy
Graphs
994. Pacific Atlantic Water Flow
Easy
Graphs
995. Rotting Oranges — Multi-Source BFS
Easy
Graphs
996. 01 Matrix — Distance to Nearest Zero
Easy
Graphs
997. Shortest Path in Binary Matrix
Easy
Graphs
998. Check if There is a Valid Path in Grid
Easy
Graphs
1003. Map of Highest Peak (BFS)
Easy
Graphs
1004. Walls and Gates — Multi-Source BFS
Easy
Graphs
1005. Find if Path Exists in Grid
Easy
Graphs
1006. Count Reachable Nodes from a Source
Easy
Graphs
1007. Coloring Border
Easy
Graphs
1013. Topological Sort Using Kahn's Algorithm (BFS)
Easy
Graphs
1016. Find Mother Vertex in Directed Graph
Easy
Graphs
1018. Check if Graph is Tree
Easy
Graphs
1020. Minimum Moves to Reach Target in Knight Moves
Easy
Graphs
1021. Clone an Undirected Graph
Easy
Graphs
1022. Word Ladder I — Minimum Transformations
Easy
Graphs
1024. Minimum Steps to Reach End in Circular Array
Easy
Graphs
1032. Cheapest Flights Within K Stops
Medium
Graphs
1041. Course Schedule II — Return Order
Medium
Graphs
1044. Parallel Courses — Minimum Semesters
Medium
Graphs
1054. Word Ladder II — All Shortest Paths
Medium
Graphs
1055. Open the Lock — Minimum Turns
Medium
Graphs
1056. Minimum Jumps to Reach End (Jump Game BFS)
Medium
Graphs
1057. Snakes and Ladders
Medium
Graphs
1058. Bus Routes — Minimum Buses to Destination
Medium
Graphs
1059. Shortest Path Visiting All Nodes (Bitmask BFS)
Medium
Graphs
1061. Keys and Rooms
Medium
Graphs
1066. As Far from Land as Possible
Medium
Graphs
1067. Minimum Obstacles to Reach Corner (0-1 BFS)
Medium
Graphs
1068. Cut Off Trees for Golf Event
Medium
Graphs
1069. Minimum Cost to Make at Least One Valid Path
Medium
Graphs
1072. Check if Graph is Bipartite (BFS)
Medium
Graphs
1081. Max Flow — Edmonds-Karp (BFS-based)
Hard
Graphs
1095. Genetic Mutation — Minimum Mutations (BFS)
Hard
Graphs
1096. Shortest Bridge
Hard
Graphs
1098. Jump Game IV — BFS with Value Groups
Hard
Graphs
1099. Shortest Path with Obstacle Elimination
Hard
Graphs
1110. Minimum Jumps to Reach Home (Implicit BFS)
Hard
Graphs
1227. Shortest Path Visiting All Nodes (BFS + Bitmask)
Hard
Dynamic Programming
1383. Shortest Path Visiting All Nodes
Hard
Bit Manipulation