Skip to content

Commit

Permalink
Create ReadmeForcpp.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandhya-Rani05 authored Oct 3, 2023
1 parent 44d51b6 commit d2a0987
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LeetCode/Trapping-Rain-Water/ReadmeForcpp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Intuition for my code:

Set two pointers l and r to the left and right end of height.
Then we get the minimum height (minHeight) of these pointers since the level of the water cannot be higher than it.
Then we move the two pointers towards the center.
If the coming level is less than minHeight, then it will hold some water.
Fill the water until we meet some "barrier" (with height larger than minHeight) and update l and r to repeat this process

1 comment on commit d2a0987

@Sandhya-Rani05
Copy link
Author

Choose a reason for hiding this comment

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

I have committed a code and Readme file in cpp. Please merge it.

Please sign in to comment.