Google Breadth First Search Questions

196 breadth first search problems asked at Google interviews

Easy (17)Medium (122)Hard (57)

Questions

TitleDifficulty
Number of IslandsMedium
Course ScheduleMedium
Rotting OrangesMedium
Coin ChangeMedium
Same TreeEasy
Surrounded RegionsMedium
Pacific Atlantic Water FlowMedium
Apply SubstitutionsMedium
Binary Tree Level Order TraversalMedium
Invert Binary TreeEasy
Number of ProvincesMedium
Word LadderHard
Symmetric TreeEasy
Swim in Rising WaterHard
Clone GraphMedium
Perfect SquaresMedium
Binary Tree Zigzag Level Order TraversalMedium
Trapping Rain Water IIHard
Longest Increasing Path in a MatrixHard
01 MatrixMedium
Serialize and Deserialize Binary TreeHard
Shortest Path in a Grid with Obstacles EliminationHard
Evaluate DivisionMedium
Maximum Depth of Binary TreeEasy
Path With Minimum EffortMedium
Cheapest Flights Within K StopsMedium
Course Schedule IIMedium
Alien DictionaryHard
Network Delay TimeMedium
Redundant ConnectionMedium
Accounts MergeMedium
Vertical Order Traversal of a Binary TreeHard
Find Eventual Safe StatesMedium
Bus RoutesHard
Shortest Path in Binary MatrixMedium
Number of Closed IslandsMedium
Find the Safest Path in a GridMedium
Binary Tree Right Side ViewMedium
Max Area of IslandMedium
Height of Binary Tree After Subtree Removal QueriesHard
Minimum Cost to Make at Least One Valid Path in a GridHard
Detonate the Maximum BombsMedium
Shortest Path Visiting All NodesHard
Flood FillEasy
Making A Large IslandHard
Graph Valid TreeMedium
Keys and RoomsMedium
Regions Cut By SlashesMedium
Binary Tree Vertical Order TraversalMedium
Maximum Level Sum of a Binary TreeMedium
Snakes and LaddersMedium
Minimum Absolute Difference in BSTEasy
Minimum Height TreesMedium
Word Ladder IIHard
All Nodes Distance K in Binary TreeMedium
Number of EnclavesMedium
Two Sum IV - Input is a BSTEasy
Maximum Width of Binary TreeMedium
Island PerimeterEasy
Is Graph Bipartite?Medium
Walls and GatesMedium
Path SumEasy
Shortest Distance from All BuildingsHard
Count Servers that CommunicateMedium
Find if Path Exists in GraphEasy
Time Needed to Inform All EmployeesMedium
Find All People With SecretHard
Kth Ancestor of a Tree NodeHard
Shortest BridgeMedium
Path With Maximum Minimum ValueMedium
Number of Connected Components in an Undirected GraphMedium
Minimum Obstacle Removal to Reach CornerHard
Minimum Knight MovesMedium
Jump Game IVHard
Populating Next Right Pointers in Each NodeMedium
The MazeMedium
Similar String GroupsHard
Redundant Connection IIHard
Disconnect Path in a Binary Matrix by at Most One FlipMedium
Sentence Similarity IIMedium
Map of Highest PeakMedium
Smallest Rectangle Enclosing Black PixelsHard
Water and Jug ProblemMedium
Deepest Leaves SumMedium
Freedom TrailHard
Shortest Path to Get All KeysHard
All Ancestors of a Node in a Directed Acyclic GraphMedium
Minimum Distance Between BST NodesEasy
Couples Holding HandsHard
K-Similar StringsHard
Last Day Where You Can Still CrossHard
Minimum Depth of Binary TreeEasy
Operations on TreeMedium
Minimum Operations to Convert NumberMedium
The Maze IIMedium
Brace Expansion IIHard
Minimum Path Cost in a Hidden GridMedium
Brace ExpansionMedium
Frog Position After T SecondsHard
Remove All Ones With Row and Column Flips IIMedium
Complete Binary Tree InserterMedium
Tree DiameterMedium
Find Elements in a Contaminated Binary TreeMedium
Find Nearest Right Node in Binary TreeMedium
Correct a Binary TreeMedium
Minimum Genetic MutationMedium
Serialize and Deserialize N-ary TreeHard
Employee ImportanceMedium
Nested List Weight SumMedium
Minimum Time to Visit a Cell In a GridHard
Populating Next Right Pointers in Each Node IIMedium
Detect Cycles in 2D GridMedium
Sum of Left LeavesEasy
Remove Invalid ParenthesesHard
Smallest String With SwapsMedium
Check Completeness of a Binary TreeMedium
Lowest Common Ancestor of Deepest LeavesMedium
Minimize the Maximum Edge Weight of GraphMedium
Nearest Exit from Entrance in MazeMedium
Binary Tree Level Order Traversal IIMedium
Open the LockMedium
Divide Nodes Into the Maximum Number of GroupsHard
Cousins in Binary Tree IIMedium
Reverse Odd Levels of Binary TreeMedium
Find Largest Value in Each Tree RowMedium
Minimum Jumps to Reach End via Prime TeleportationMedium
Count Good Nodes in Binary TreeMedium
Escape the Spreading FireHard
Possible BipartitionMedium
Merge Two Binary TreesEasy
Cousins in Binary TreeEasy
Second Minimum Time to Reach DestinationHard
Course Schedule IVMedium
Nested List Weight Sum IIMedium
Average of Levels in Binary TreeEasy
Power Grid MaintenanceMedium
Print Binary TreeMedium
Number of Distinct IslandsMedium
Minimum Score of a Path Between Two CitiesMedium
Smallest Subtree with all the Deepest NodesMedium
Coloring A BorderMedium
MinesweeperMedium
Count Sub IslandsMedium
Shortest Distance After Road Addition Queries IMedium
Find a Safe Walk Through a GridMedium
Serialize and Deserialize BSTMedium
Maximize the Number of Target Nodes After Connecting Trees IMedium
Maximum Number of Points From Grid QueriesHard
All Paths From Source to TargetMedium
Maximize the Number of Target Nodes After Connecting Trees IIHard
Sort Items by Groups Respecting DependenciesHard
Longest Cycle in a GraphHard
Amount of Time for Binary Tree to Be InfectedMedium
N-ary Tree Level Order TraversalMedium
Check if the Rectangle Corner Is ReachableHard
Find Minimum Diameter After Merging Two TreesHard
Univalued Binary TreeEasy
Reorder Routes to Make All Paths Lead to the City ZeroMedium
Minimum Operations to Equalize Binary StringHard
Minimum Moves to Move a Box to Their Target LocationHard
Count Unreachable Pairs of Nodes in an Undirected GraphMedium
Find Bottom Left Tree ValueMedium
Maximum Number of Fish in a GridMedium
Minimum Fuel Cost to Report to the CapitalMedium
Sliding PuzzleHard
Minimum Number of Operations to Sort a Binary Tree by LevelMedium
Number of Distinct Islands IIHard
Count the Number of Complete ComponentsMedium
Maximum Candies You Can Get from BoxesHard
Number of Operations to Make Network ConnectedMedium
Check if There is a Valid Path in a GridMedium
Shortest Path with Alternating ColorsMedium
Maximum Partition FactorHard
Most Profitable Path in a TreeMedium
Add One Row to TreeMedium
Validate Binary Tree NodesMedium
Check Knight Tour ConfigurationMedium
Maximum Number of Moves to Kill All PawnsHard
Kth Largest Sum in a Binary TreeMedium
Maximize Amount After Two Days of ConversionsMedium
Contain VirusHard
Numbers With Same Consecutive DifferencesMedium
Closest Node to Path in TreeHard
Minimize Malware SpreadHard
Web Crawler MultithreadedMedium
Find All Groups of FarmlandMedium
Shortest Path in a Hidden GridMedium
The Maze IIIHard
Count Islands With Total Value Divisible by KMedium
Escape a Large MazeHard
Zuma GameHard
Minimum Number of Days to Disconnect IslandHard
As Far from Land as PossibleMedium
Reachable Nodes With RestrictionsMedium
Minimum Edge Reversals So Every Node Is ReachableHard
Shortest Cycle in a GraphHard

Showing 196 questions