Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Leetcode Number Of islands Solution #4483

Open
nizar787 opened this issue Jun 26, 2023 · 6 comments
Open

Add Leetcode Number Of islands Solution #4483

nizar787 opened this issue Jun 26, 2023 · 6 comments

Comments

@nizar787
Copy link

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@bhalerao-2002
Copy link

Hello @nizar787 , I can add that solution, Assign me this issue under hacktoberfest

sajithsojan added a commit to sajithsojan/hacktoberfest2021 that referenced this issue Sep 26, 2023
added leetcode problem 200 number of island solution in c++.
solved issue keshavsingh4522#4483
@sajithsojan
Copy link

please review my code

@alipsa2000
Copy link

This is the code can you please review this code
#include
#include
using namespace std;
class Solution {
public:
int numIslands(vector<vector>& grid) {
if (grid.empty() || grid[0].empty()) {
return 0;
}
int numIslands = 0;
int m = grid.size();
int n = grid[0].size();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (grid[i][j] == '1') {
numIslands++;
dfs(grid, i, j);
}
}
}
return numIslands;
}
private:
void dfs(vector<vector>& grid, int i, int j) {
if (i < 0 || i >= grid.size() || j < 0 || j >= grid[0].size() || grid[i][j] != '1') {
return;
}
grid[i][j] = '0';
dfs(grid, i - 1, j);
dfs(grid, i + 1, j);
dfs(grid, i, j - 1);
dfs(grid, i, j + 1);
}
};

@PRITISH212121
Copy link

i have solved this problem before,i m attaching my leetcode profile,please assign it to me
https://leetcode.com/pritishyo10/

@navya975
Copy link

navya975 commented Oct 1, 2023

I have solved this problem before,I am attaching my leetcode profile,please assign it to me
https://leetcode.com/navya975/

@mrinalproxy
Copy link

assigned this problem to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants