548
1 Like

DSA Crash Course [Part 63] - Island Count Approach

In this lesson, Alvin explores the strategy to solving the following interview problem:

Write a function, island_count, that takes in a grid containing Ws and Ls. W represents water and L represents land. The function should return the number of islands on the grid. An island is a vertically or horizontally connected region of land.

grid = [
['W', 'L', 'W', 'W', 'W'],
['W', 'L', 'W', 'W'