Skip to content

Added Trapping Rainwater Problem (Most optimized way)#213

Closed
chandradeep12 wants to merge 1 commit into
MrunaliniPachpute:mainfrom
chandradeep12:addtag
Closed

Added Trapping Rainwater Problem (Most optimized way)#213
chandradeep12 wants to merge 1 commit into
MrunaliniPachpute:mainfrom
chandradeep12:addtag

Conversation

@chandradeep12

Copy link
Copy Markdown

🚀 Pull Request

🔖 Description

This PR implements the optimized solution for the Trapping Rainwater Problem in C++ using the two-pointer technique.
The solution efficiently computes the total amount of water trapped between bars after rainfall.

✅ Checklist

My code follows the project’s guidelines and style.

I have commented my code where necessary.

I have updated the documentation if needed.

I have tested the changes and confirmed they work as expected.

My PR is linked to a GitHub issue.

🙌 Additional Notes

Implemented O(n) time and O(1) space solution using the two-pointer approach.

Added dynamic input handling and clear output formatting.

The code is clean, beginner-friendly, and well-commented for easy understanding.

Great for understanding prefix-suffix logic, array traversal, and optimization techniques.

hey @MrunaliniPachpute please accept and merge this PR and kindly label it under the hactoberfest tag.
Thank you..

@github-actions

Copy link
Copy Markdown

Thanks for creating a PR for your Issue! ☺️

Kindly Star the repo ⭐ We'll review Your PR as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@MrunaliniPachpute

Copy link
Copy Markdown
Owner

Is this PR connected to any issue?

@chandradeep12

chandradeep12 commented Oct 27, 2025

Copy link
Copy Markdown
Author

Is this PR connected to any issue?

Yesss it is i had raised a issue earlier.. You said to give me in pseudocode format but i have already solved in C++ and created the PR as well.. Issue number #212

@MrunaliniPachpute

MrunaliniPachpute commented Oct 27, 2025

Copy link
Copy Markdown
Owner

Hi @chandradeep12

Thank you for your contribution and for taking the effort to implement the Trapping Rainwater Problem!
However, please note that we do not accept language-specific implementations — all problem solutions should be in pseudocode format only, as per our project guidelines.

Kindly make sure to get an issue assigned before starting to work on it to avoid duplication or misalignment with the project’s scope.

You can either:

  • Convert this solution into pseudocode and update the PR accordingly, OR
  • If you prefer not to, go ahead and close this PR and the linked issue Trapping Rainwater Problem in C++ #212 to maintain consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants