Trapping Rainwater Problem | Leetcode #42

preview_player
Показать описание
This video explains a very important programming interview problem which is the trapping rainwater problem.In this problem, given an array representing elevation map, we are required to find the amount of water the elevation map can trap.I have explained all the approaches for solving this problem starting from the bruteforce approach to the most optimal approach.I have shown how we can process and highly optimize the time complexity.

CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)

======================================PLEASE DONATE=============================
==============================================================================

=======================================================================
USEFUL LINKS:

RELATED LINKS:

Рекомендации по теме
Комментарии
Автор

This is one of the best explanations I've seen so far on the internet.

TW-ukxi
Автор

Man, you just made a hard leetcode problem so easy that I just coded it all by myself successfully.
Can't thank you enough

saleheen
Автор

great video sir, i had come to understand the O(1) space solution, and your explanation is shorter and much much crisper than anyone else's. keep up the great work.

codingessential
Автор

I had seen your video of solving the area of histogram ..so first thing came in my mind to take 2 stacks to get left and right max ...while writing the code I realized that I can solve this without stack .... after that I saw your complete video and got o(1) space method ... this is crazy

neerajpandey
Автор

Your channel is really great! You should definitely have more subscriber than most of other creators who create useless roadmaps.

YashHalgaonkar
Автор

I've watched many of your videos. Your explanations are always very easy to understand. Thank you for creating these videos; you are doing so much good.

kushagrashekhawat
Автор

Index starts from 1 to arr.len-1

Totalwater+=Math.min(leftmax of current index element, rightmax of current index element)-current index element

ravisankarmaruramesh
Автор

Awesome explanation . Even kids can understand after watching this video. Thank you very much

ravikumar-khgi
Автор

Thanks a ton for explaining solution in detail. It's really a tough job. Keep it up!!!

sumeetchawla
Автор

Best solution explaination to this problem. 🙌

rachanasingh
Автор

Thank you for this video! I appreciate you drawing out the base cases and explaining everything in detail. This is definitely the most helpful video for this problem :)

hnsc
Автор

I did not saw the whole video, skipped the last 10 minutes and got rejected in a ds algo round today. feeling sad.

ajayk
Автор

Thank you so much you explained these questions by previously known methods because others are making it very complicated for reducing code size()

yashkhandelwal
Автор

sir plz make the videos of 2d matrix in cpp ?? problems of 2d matrix

jasmeenkaur
Автор

Water can be stored with two block if there is a gap between them. Couldn’t get the base case

Nitisharav
Автор

any TELEGRAM Group ? above link is invalid

huansir
Автор

This is one of the best explanations I've seen so far on the internet.

novascotia
join shbcf.ru