Skip to content

Implement Trapped Rain Water Problem #712

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
merged 9 commits into from
May 18, 2024

Conversation

sozelfist
Copy link
Contributor

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

@sozelfist sozelfist requested review from imp2002 and vil02 as code owners May 11, 2024 02:10
@codecov-commenter
Copy link

codecov-commenter commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.78%. Comparing base (b86b003) to head (c2f9c3a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #712   +/-   ##
=======================================
  Coverage   94.78%   94.78%           
=======================================
  Files         299      300    +1     
  Lines       22245    22274   +29     
=======================================
+ Hits        21084    21113   +29     
  Misses       1161     1161           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sozelfist sozelfist requested a review from vil02 May 14, 2024 01:26
- Create iterator in a single function
- Add tests
- Rewrite docstring
Copy link
Member

@vil02 vil02 left a comment

Choose a reason for hiding this comment

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

The code looks good. Since the suggested changes are small, I will push them, to speed up the whole process.

@vil02 vil02 merged commit 4248281 into TheAlgorithms:master May 18, 2024
4 checks passed
@sozelfist sozelfist deleted the dp/trapped_rainwater branch May 18, 2024 07:12
sozelfist added a commit to sozelfist/Rust that referenced this pull request May 20, 2024
* chore: add `trapped_rainwater.rs` to DIRECTORY.md

* feat: implement Trapped Rain Water algorithm

* chore: add tests

* chore: rename `height` to `elevation_map`

* ref: change `Vec<u32` to `[u32]`

* ref: refactor implementation
- Create iterator in a single function
- Add tests
- Rewrite docstring

* tests: add more test cases

* style: simplify logic by removing redundant branch

---------

Co-authored-by: Piotr Idzik <[email protected]>
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.

3 participants