DSA Python - Number of Enclaves | Boundary BFS Grid Traversal | Leetcode 1020 - Part 128 [Hindi]
Code and Debug
0:00 / 0:00
DSA Python - Number of Enclaves | Boundary BFS Grid Traversal | Leetcode 1020 - Part 128 [Hindi]
3 048 просмотров · 1 г. назад
Code and Debug
51,1 тыс. подписчиков
3 048 просмотров · 1 г. назад
🚀 Welcome to Part 128 of Code & Debug’s DSA Python Course 2025!
In this video, we solve Leetcode 1020: Number of Enclaves, where we count all land cells (1) that cannot reach the boundary. We solve this using BFS from boundary land cells and then count unvisited 1s.
📚 What you’ll learn in this video:
✅ What is an enclave and why boundary-connected land must be excluded
✅ BFS from all boundary 1s to mark reachable land
✅ Visited matrix usage to track reachable cells
✅ Final counting logic for unreachable 1s
✅ Time and space complexity analysis
💡 Why is this important?
This is a classic problem that enhances your understanding of boundary-based BFS in grids, and builds intuition for related problems like surrounded regions, number of islands, and flood-fill edge protection. Frequently asked in product-based interviews.
👉 Practice the problem on Leetcode:
🔗 https://leetcode.com/problems/number-...
👉 Refer to the article for better understanding:
📌 https://codeanddebug.in/blog/number-o...
👉 📄 Access the full YouTube DSA Playlist Sheet (All Questions in Order):
🔗 https://docs.google.com/spreadsheets/...
👉 Enroll in this FREE DSA Python course here:
🔗 https://codeanddebug.in/course/master...
👉 Enroll for Self-Paced Advanced DSA course here:
🔗 https://codeanddebug.in/course/zero-t...
🙏 Thank you for supporting Code & Debug! Don’t forget to like, share, and subscribe to our channel. Hit the 🔔 bell icon to stay updated with our latest lectures.
#NumberOfEnclaves #BoundaryBFS #GridTraversal #Leetcode1020 #EnclaveCount #PythonDSA #DSAPythonCourse #CodeAndDebug #DSA2025 #MatrixProblems #Part128 #CodingInterviews