Added Trapping Rainwater Problem (Most optimized way)#213
Conversation
Thanks for creating a PR for your Issue!
|
|
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 |
|
Thank you for your contribution and for taking the effort to implement the Trapping Rainwater Problem! 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:
|
🚀 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..