Skip to content

[Matrix] Max area of island problem solved DFS algorithm #6918

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

Merged

Conversation

kondekarshubham123
Copy link
Contributor

Describe your change:

Maximum area of island problem added.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 10, 2022
kondekarshubham123 and others added 3 commits October 10, 2022 23:01
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
@algorithms-keeper algorithms-keeper bot added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Oct 10, 2022
@kondekarshubham123
Copy link
Contributor Author

hi @CaedenPH,
I have made changes as per suggestions

please merge this PR under hackoberfest label

Copy link

@kothekarakshata kothekarakshata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, new question

Copy link

@kothekarakshata kothekarakshata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewed, good work

@kondekarshubham123 kondekarshubham123 changed the title Max area of island problem solved DFS algorithm; a pr under Hacktoberfest Max area of island problem solved DFS algorithm Oct 11, 2022
@kondekarshubham123 kondekarshubham123 changed the title Max area of island problem solved DFS algorithm [Matrix] Max area of island problem solved DFS algorithm Oct 11, 2022
@kondekarshubham123 kondekarshubham123 requested review from CenTdemeern1 and CaedenPH and removed request for CaedenPH and CenTdemeern1 October 11, 2022 11:10
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 11, 2022
@kondekarshubham123 kondekarshubham123 requested review from CaedenPH and removed request for CenTdemeern1 October 11, 2022 11:13
Copy link
Contributor

@CenTdemeern1 CenTdemeern1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend making some changes here, but I suppose these aren't explicitly required...

@kondekarshubham123
Copy link
Contributor Author

yes @CenTdemeern1 , I had put : set back
Thanks

@kondekarshubham123
Copy link
Contributor Author

Hi @cclauss or @dhruvmanila,
Please review this PR as well

Thanks

kondekarshubham123 and others added 3 commits October 18, 2022 00:31
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 17, 2022
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 17, 2022
@kondekarshubham123 kondekarshubham123 requested review from cclauss and removed request for CaedenPH October 17, 2022 19:24
Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@cclauss
Copy link
Member

cclauss commented Oct 18, 2022

Use that max 88 characters to put comments on fewer lines.
Define one matrix and use it multiple times.
If you pass me the matrix, I can calculate rows and cols.
Iterate thru the matrix like a Pythonista...

    for row, line in enumerate(mat):
        for col, item in enumerate(line):
            if item == 1 and (row, col) not in seen:

@cclauss cclauss merged commit 2ca695b into TheAlgorithms:master Oct 18, 2022
@cclauss cclauss added hacktoberfest hacktoberfest-accepted Accepted to be counted towards Hacktoberfest and removed awaiting reviews This PR is ready to be reviewed labels Oct 18, 2022
@kondekarshubham123 kondekarshubham123 deleted the matrix/max_area_of_island branch October 19, 2022 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest hacktoberfest-accepted Accepted to be counted towards Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants