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

Trapping Rain Water Problem in C++ #85

Open
abhagangwar712 opened this issue Oct 15, 2024 · 1 comment
Open

Trapping Rain Water Problem in C++ #85

abhagangwar712 opened this issue Oct 15, 2024 · 1 comment

Comments

@abhagangwar712
Copy link

abhagangwar712 commented Oct 15, 2024

Please let me contribute this issue under hactoberfest.

Problem Description:
The Trapping Rainwater problem involves calculating the amount of water that can be trapped after a rainstorm given a list of non-negative integers representing the elevation map. The width of each bar is 1. The goal is to find the maximum amount of water that can be trapped.

Optimized Approach using Two Pointers (O(n) time complexity):

Use two pointers to traverse the elevation map from both ends.
Track the maximum heights seen so far from both sides.
Calculate the water trapped based on the minimum of these heights.

@mihir-k64
Copy link

Pls assign me this under hacktober

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

No branches or pull requests

2 participants