We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- DFS: Connected Cell in a Grid
- Discussions
DFS: Connected Cell in a Grid
DFS: Connected Cell in a Grid
Sort by
recency
|
231 Discussions
|
Please Login in order to post a comment
why do they want DFS? component size problems are more intuitively done with BFS.
DFS recursive, not iterative:
This was my timed solution. I am not very good a t matrix problems so if anyone could view my code and tell me why it may be abd or ugly or any improvements I'd greatly appreciate it!
int maxRegion(vector> grid) { int max_region_amt = 0; int n = grid.size(); int m = grid[0].size(); stack q; vector visited(n*m); int i = 0; while(i < n * m){
}
All the graph methods are reasonable and make sense given the category
However, is it possible to solve this with a couple convolutional passes?
Python
Simple Java Solution