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.
Connected Cells in a Grid
Connected Cells in a Grid
Sort by
recency
|
267 Discussions
|
Please Login in order to post a comment
c++ using bfs (breath first search) approach
define pii pair
define mk make_pair
int bfs(int r, int c, vector> &mat, vector> &vis, int n, int m) { int surf = 0; queue q; q.push(mk(r,c)); // cout << "starting " << r << " "<
}
int connectedCell(vector> matrix) { int n = matrix.size(), m = matrix[0].size(); vector> vis(n, vector(m,false));
}
C++ solution using backtracking(similar to rat in a maze)