8

Trapping Rain Water | SDE Sheet | Arrays

 2 years ago
source link: https://www.geeksforgeeks.org/videos/trapping-rain-water-r6kisf/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Trapping Rain Water
Trapping Rain Water | SDE Sheet | Arrays
Video Player is loading.
Loaded: 0.48%
00:00
Remaining Time -10:19
  • 240 Views
  • 20/04/2022

In this video we will see how to compute how much water a given 'n' non-negative integers representing an elevation map where the width of each bar is 1, is able to trap after raining.

Examples: Input: arr[] = {2, 0, 2} Output: 2 Explanation: Imagine there are 3 columns. Now there are 2 bars on the 1st and 3rd column each and none in the second. Therefore the amount of water trapped is 2 (in the middle column).

Check out the video to see how we implement this!!

Practice Problem: https://practice.geeksforgeeks.org/problems/trapping-rain-water-1587115621/1 Article: https://www.geeksforgeeks.org/trapping-rain-water/ SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK