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

Implement Trapped Rain Water Problem #712

Merged
merged 9 commits into from May 18, 2024

Conversation

TruongNhanNguyen
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.

@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.

src/dynamic_programming/trapped_rainwater.rs Outdated Show resolved Hide resolved
src/dynamic_programming/trapped_rainwater.rs Outdated Show resolved Hide resolved
src/dynamic_programming/trapped_rainwater.rs Show resolved Hide resolved
- 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.

src/dynamic_programming/trapped_rainwater.rs Show resolved Hide resolved
src/dynamic_programming/trapped_rainwater.rs Show resolved Hide resolved
src/dynamic_programming/trapped_rainwater.rs Outdated Show resolved Hide resolved
@vil02 vil02 merged commit 4248281 into TheAlgorithms:master May 18, 2024
4 checks passed
@TruongNhanNguyen TruongNhanNguyen deleted the dp/trapped_rainwater branch May 18, 2024 07:12
TruongNhanNguyen added a commit to TruongNhanNguyen/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 <65706193+vil02@users.noreply.github.com>
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.

None yet

3 participants