Skip to content

Fix: resolve unsigned loop bug in trapped rainwater implementation#3130

Open
Akash-Karma wants to merge 1 commit intoTheAlgorithms:masterfrom
Akash-Karma:fix-trapped-rainwater-bug
Open

Fix: resolve unsigned loop bug in trapped rainwater implementation#3130
Akash-Karma wants to merge 1 commit intoTheAlgorithms:masterfrom
Akash-Karma:fix-trapped-rainwater-bug

Conversation

@Akash-Karma
Copy link
Copy Markdown

Description of Change

Checklist

  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes: Fixed a bug caused by reverse iteration using std::size_t, which could lead to underflow.

Changes:

  • Fixed reverse loop condition
  • Improved type safety using uint64_t
  • All test cases pass

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

Successfully merging this pull request may close these issues.

1 participant