Quantcast
Channel: Find maximum area of island in matrix - Code Review Stack Exchange
Browsing all 4 articles
Browse latest View live

Answer by 200_success for Find maximum area of island in matrix

Your code is somewhat Pythonic, but could use some improvements.You seem to be under the impression that you are exploring each island by performing a breadth-first-search using a queue (named q)....

View Article



Answer by Graipher for Find maximum area of island in matrix

If you were trying to solve this problem in real life (and not on leetcode), I would use existing tools for this. Specifically, with scikit-image this becomes rather easy:import numpy as npfrom skimage...

View Article

Answer by l0b0 for Find maximum area of island in matrix

Some suggestions:Nested functions are unusual; typically they would be neighbour functions instead. This ensures that all the context that each function needs is passed to it, making it easier to grasp...

View Article

Find maximum area of island in matrix

I recently solved the problem below from leetcode:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical)....

View Article
Browsing all 4 articles
Browse latest View live




Latest Images