Перейти к содержимому

Shortest Safe Route in Grid | BFS O(N×M) | Landmine Grid Problem | GFG & LeetCode

Coding practice

0:00 / 0:00

Shortest Safe Route in Grid | BFS O(N×M) | Landmine Grid Problem | GFG & LeetCode

63 просмотра · 1 мес. назад
Coding practice
88 подписчиков
63 просмотра · 1 мес. назад
In this video, we solve Shortest Safe Route in Grid, where the goal is to find the minimum number of steps needed to travel from any cell in the leftmost column to any cell in the rightmost column while avoiding landmines and cells adjacent to landmines. 🚀 Approach Covered: • Optimized BFS — O(N × M) The solution first identifies unsafe cells around landmines and then uses BFS to find the shortest safe path through the remaining cells. 🎯 Difficulty: Medium 📚 Topics: BFS, Matrix 🌐 Platforms: GeeksforGeeks (GFG), LeetCode 💼 Company Tags: None This is a great problem for practicing BFS on matrices, shortest paths in grids, and safe-cell traversal for coding interviews. #DSA #BFS #Matrix #Grid #ShortestPath #GeeksForGeeks #LeetCode #CodingInterview #Graph #Java #Programming