BestHub
Discover
Artificial IntelligenceBackend DevelopmentMobile DevelopmentProduct ManagementCloud NativeFrontend DevelopmentFundamentalsBig DataCloud ComputingGame DevelopmentR&D ManagementOperationsDatabasesInformation SecurityBlockchainUser Experience DesignInterview ExperienceIndustry Insights
View all →
TopicsTagsTrendsRanking
Sign in
Discover
Artificial Intelligence Backend Development Mobile Development Product Management Cloud Native Frontend Development Fundamentals Big Data Cloud Computing Game Development R&D Management Operations Databases Information Security Blockchain User Experience Design Interview Experience Industry Insights View all →
TopicsTagsTrendsRanking
Sign in
  1. Home
  2. / Tags
  3. / grid algorithm
NiuNiu MaTe
NiuNiu MaTe
Nov 24, 2021 · Fundamentals

How to Count Islands in a Grid Using DFS and BFS – Step‑by‑Step Guide

This article explains the classic "Number of Islands" problem, presents two example grids, and demonstrates how depth‑first search (DFS) and breadth‑first search (BFS) can be applied to count isolated land masses in a 2D matrix.

BFSDFSgraph traversal
0 likes · 6 min read
How to Count Islands in a Grid Using DFS and BFS – Step‑by‑Step Guide
BestHub

Editorial precision for engineers who prefer signal over noise. Deep reads, careful curation, and sharper frontiers in software.

Best Hub for Dev. Power Your Build.
Navigation
Status Discover Tags Topics System Status Privacy Terms Rss Feed