9 Rain Water Trapping

  Рет қаралды 184,901

Aditya Verma

Aditya Verma

Күн бұрын

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
Input: arr[] = {2, 0, 2}
Output: 2
Structure is like below
| |
|_|
We can trap 2 units of water in the middle gap.
Input: arr[] = {3, 0, 0, 2, 0, 4}
Output: 10
Structure is like below
|
| |
| | |
|__|_|
We can trap "3*2 units" of water between 3 an 2,
"1 unit" on top of bar 2 and "3 units" between 2
and 4. See below diagram also.
Refer : www.geeksforge... .
------------------------------------------------------------------------------------------
Here are some of the gears that I use almost everyday:
🖊️ : My Pen (Used in videos too): amzn.to/38fKSM1
👨🏻‍💻 : My Apple Macbook pro: amzn.to/3w8iZh6
💻 : My gaming laptop: amzn.to/3yjcn23
📱 : My Ipad: amzn.to/39yEMGS
✏️ : My Apple Pencil: amzn.to/3kMnKYf
🎧 : My Headphones: amzn.to/3kMOzM7
💺 : My Chair: amzn.to/385weqR
🛋 : My Table: amzn.to/3kMohtd
⏰ : My Clock: amzn.to/3slFUV3
🙋🏻‍♀️ : My girlfriend: amzn.to/3M6zLDK ¯\_(ツ)_/¯
PS: While having good gears help you perform efficiently, don’t get under the impression that they will make you successful without any hard work.

Пікірлер: 522
@punee673
@punee673 5 ай бұрын
This video i watched a year ago definitely got me my job now in my final year. You taught so well i was able to recollect every approach from this. So thanks a ton.
@subhajitdutta5216
@subhajitdutta5216 4 жыл бұрын
Great explanation, and u r right jenny mam is pretty😂
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
right? You feel me ? !! 😂😂😂😂😂😂😂😂😂😂😂
@subhajitdutta5216
@subhajitdutta5216 4 жыл бұрын
@@TheAdityaVerma yup😂🙏, waiting for ur videos though
@vivektyson
@vivektyson 4 жыл бұрын
@@TheAdityaVerma awaaz bhi unka kitna pyaara hai
@satishchandra2652
@satishchandra2652 4 жыл бұрын
​@@TheAdityaVerma hahhah
@LetszGoo
@LetszGoo 4 жыл бұрын
haha she is theory teacher. whenever i see her video i thought seh never coded in her whole life.
@amanagarwal2022
@amanagarwal2022 3 жыл бұрын
Jenny kafi achchha padati hai +sunder bhi dikhti hai! Koi kinta bhi achcha DSA karle aakhir meh rehata engineer he hai 😂😂
@snverma5357
@snverma5357 3 жыл бұрын
men will be men...sargam lolol
@Shourya_performs
@Shourya_performs 3 жыл бұрын
😂😂
@deepakffyt2844
@deepakffyt2844 Жыл бұрын
Exam me pass hone ke liye jada tar padhte hai
@joichirogaming
@joichirogaming 4 жыл бұрын
The best part of his videos is: he explains from starting tells all expected approaches and their disadvantages and finally tells approach that will give the correct answer and then gives the solution. Hats off!!!!
@srajikagupta3627
@srajikagupta3627 4 жыл бұрын
Volume is very low sir please try to keep it a little more 😅
@varungupta420
@varungupta420 Жыл бұрын
bhaii boats ke headphones se hi sunai de rha merko
@abhishekbhowmick5912
@abhishekbhowmick5912 10 ай бұрын
Thanks for this comment, else I would consider this class as mute!
@devashishbawa8236
@devashishbawa8236 3 жыл бұрын
15:50 we understand the double meaning laughter 😂😂😂
@vagabondfoodie5788
@vagabondfoodie5788 2 жыл бұрын
😂😂😂😂😂.... Are are sir 😭😭😭😂😂😂
@VishalSinghrajput-hb2sn
@VishalSinghrajput-hb2sn 10 ай бұрын
kaise pani nikal na hai
@ce038_divanshsingh3
@ce038_divanshsingh3 7 ай бұрын
jenny ka pani
@dsa9980
@dsa9980 4 жыл бұрын
Aadi bhai you rock yarr.. !! Bhai aapka teaching style todd hai.. ek baar dekhte hi sab samaz aata hai.. bahot dua lagne wali hai aapko sabki.. You doing a commendable job..!! Hats off yarr..!! I hated DS Algo kyunki mujhe bahot tough lagta tha ye sab.. pr ab nahi.. sala kash kisine aisa angle dikhaya hota pehle.. I love solving problems now and successfully able to find patterns in it. Thanks, man..!! Keep up the good work..!! Waiting for more..!! God bless.. :-)
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Thanks brother !! Such long comments always put a smile across my face ❤️✌️✌️ Also Do share the content amomg your friends and collage to help the channel grow !! Thanks for watching again !!
@dsa9980
@dsa9980 4 жыл бұрын
@@TheAdityaVerma Needless to say.. already shared and received a lot of praise for sharing..!! :D :P
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Thanks a ton !!
@AbhineetDeep
@AbhineetDeep 4 жыл бұрын
@@TheAdityaVerma bro thoda jor se bola kr pls..
@harishgupta8351
@harishgupta8351 3 жыл бұрын
Man, Teacher's day never made sense to me before but now after watching these videos, my thinking has changed completely. If teachers in India can focus on developing the thought process in students rather than just completing the syllabus and getting their students in merit list, a lot can change in the country.
@varungoel6981
@varungoel6981 3 жыл бұрын
Today I got selected in Flipkart all because of your videos Aditya! Besides learning technical stuff, I got to learn from you on how to handle and approach complex problems. Thanks a lot! I really owe you a lot, can't msg on LinkedIn since you haven't accepted my request but I'm gonna ping you as soon as I join to thank you :)
@crajeducation6733
@crajeducation6733 2 жыл бұрын
apna LinkedIn ka profile do to
@musclefitnesstv6550
@musclefitnesstv6550 2 жыл бұрын
@@crajeducation6733 😂😂
@adi5962
@adi5962 Жыл бұрын
​@@crajeducation6733nhi laga lagta hai
@vaishnavimovva5048
@vaishnavimovva5048 Жыл бұрын
Aditya sir is in flipkart too. Hope you get to meet him
@sankalparora9261
@sankalparora9261 4 жыл бұрын
Great video. Damn amazing. You can't imagine what great service you are delivering. I get the idea and I even figure out the whole code in between the video. This is the sign of a great teacher. He just need to give a sign to the student, and the rest becomes a story. You gave me the true picture of what is APPROACH. Otherwise, I was just understanding the idea of the problem or just memorizing how to solve it. You are a CODING GOD.
@shubhamthind8286
@shubhamthind8286 4 жыл бұрын
You are right 😁
@luckshay-l6f
@luckshay-l6f Жыл бұрын
Bro how can i use pair in java ?? Actually I am in doubt
@anshmishra3066
@anshmishra3066 Жыл бұрын
2:12 "dekhna hai to jaaker JENNY k lecture dekho dikhti bhi sundar hai aur acha bhi padhati hai" Has a separate fanbase in my college
@sadhinoor5114
@sadhinoor5114 3 жыл бұрын
Bro i really wish i found out about u sooner currently 6th sem passed and watching ur videos for recap......best teacher by far! Mad respect bhaiya!:))
@akashsrivastava9674
@akashsrivastava9674 2 жыл бұрын
Where did you get placed?
@harshkushwaha2212
@harshkushwaha2212 3 жыл бұрын
Sir, you said you would add the remaining videos later in the playlist. So can you please add them? They are really helping us. Thanks a lot.
@AniketSinha291
@AniketSinha291 4 жыл бұрын
Very good approach Of breaking down water level at each building level. Minor enhancement: the last loop just to calculate sum can be eliminated. You can instead keep adding to sum right after you calculate water level at index i. sum += water[i]; // after calculating water[i]
@aniketpathak2721
@aniketpathak2721 2 жыл бұрын
bhai ye toh stack ka sawal tha hi nhi
@aloksingh4110
@aloksingh4110 2 жыл бұрын
Aditya sir ke aagey mahaanta dikhaaega neech aadmi, jaa jaake ppap dho ganga mein
@anime4u766
@anime4u766 3 жыл бұрын
Bhaiya on fire....jenny sundar b lagti h
@himanshugusain9022
@himanshugusain9022 4 жыл бұрын
sir please complete the series , it is much needed. Hats off to your explanation ! if possible add queue playlist also
@poonamchauhan1884
@poonamchauhan1884 3 жыл бұрын
Commendable work of finding patterns and categorising problems. When will you be adding the last four problems of the list you shared in the beginning of the playlist?
@Shourya_performs
@Shourya_performs 3 жыл бұрын
waitingggggg
@amanjyotiparida5818
@amanjyotiparida5818 2 жыл бұрын
15:52 that 😈 smile...😁😁😁
@049_neeraj4
@049_neeraj4 Жыл бұрын
Explanation was really amazing, but where did we use stack.
@srinivaschaitanya3305
@srinivaschaitanya3305 Жыл бұрын
kaafi achi padathi hai aur sundar bhi dikthi hai..😂😂
@PrinceKumar-el7ob
@PrinceKumar-el7ob 3 жыл бұрын
leetcode solution for reference - for noobies like me !! int trap(vector& arr) { int n =arr.size(); vector right_max(n); vector left_max(n); // no matter what we can't store water on edge buildings left_max[0]=arr[0]; for(int i=1;i=0;i--){ right_max[i]=max(arr[i],right_max[i+1]); } int sum=0; for(int i=1;i
@kirtikhohal3313
@kirtikhohal3313 2 жыл бұрын
Thanks
@shashankbhatgs1150
@shashankbhatgs1150 2 жыл бұрын
in case someone needs a java solution: class Solution { public int trap(int[] height) { int n = height.length; int[] maxL = new int[n]; int[] maxR = new int[n]; maxL[0] = height[0]; for(int i = 1; i < n; i++){ maxL[i] = Math.max(maxL[i-1], height[i]); } maxR[n-1] = height[n-1]; for(int i = n-2; i >= 0; i--){ maxR[i] = Math.max(maxR[i+1], height[i]); } int[] water = new int[n]; for(int i = 0; i
@mfaraday4044
@mfaraday4044 4 жыл бұрын
bhai jitni tarif karu utni kam hai kya content share karte ho aap , ye channel god ka gift hai mere liye aur Aditya verma ( vishnu avatar hai mere life ke liye )
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Arreyy ni bhai, kaha Vishnuji aur kaha me 😅 Michael Faraday kese bnna hai bs wo bta do 😂✌️ jokes apart, Thanks for such a beautiful comment, Love you brother 😅✌️
@jaineshkumar794
@jaineshkumar794 Жыл бұрын
👏 Never thought DSA could be so much interesting and easy to learn. These aren't easy problems but hats off to you, after seeing your explanation it's a piece of cake ✌
@logicoverflow1240
@logicoverflow1240 3 жыл бұрын
Bhaiya mooj kara di 🔥🔥🔥 maza aagaya
@SushilKumar-es9ib
@SushilKumar-es9ib 4 жыл бұрын
Nobody can explain like you. Your explanations makes hardest problem to the easiest problem. Thanks for that
@ShubhamKumar-lb9lf
@ShubhamKumar-lb9lf 4 жыл бұрын
15:52😅😂
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
🙊🙊😂😂
@AbhijeetKumar-tm5pk
@AbhijeetKumar-tm5pk 4 жыл бұрын
😂
@i-am-mkv
@i-am-mkv 4 жыл бұрын
"Apne ko kya hai, apne ko toh bas paani nikaalna hai" 🤣
@priyanshsaxena2550
@priyanshsaxena2550 Жыл бұрын
amazing!....jenny ahhhh kyaa baat
@anupamdubey5736
@anupamdubey5736 3 жыл бұрын
Thanks a lot for the awesome explanation. I was able to code only by listening to the explanation without seeing the solution. Please keep this channel organic with such content unlike others who at a later stage adulterate their channel with ads and shortcut videos.
@baibhavagrawal3441
@baibhavagrawal3441 4 жыл бұрын
Sir i am being your big fan saala puri duniya patani lakhon kharch karke lecture video suit kar raha he aur bhai apna ek page aur mobile phone se unn sabki le raha he.. God Bless bhai.. Love you..
@Manojrohtela
@Manojrohtela 5 ай бұрын
Great explanation and Jenny sundar bhi dikhti h savage 😂😂😂😂 Was confuse with this example 1,0,2,0,1,3,1
@Gauravkr0071
@Gauravkr0071 4 жыл бұрын
aditya bhai, tum ho to sb h, vrna kch bhi nhi. dil se dhanyawaad
@adityagore2147
@adityagore2147 Жыл бұрын
2:10 had me going 😂😂😂
@praveenchouhan6388
@praveenchouhan6388 4 жыл бұрын
you nailed it!!! I liked the way you have broken the problem down and the concept of maxleft and maxright, awesome, thanks a lot!!!
@deepakdhakad8539
@deepakdhakad8539 3 жыл бұрын
2:10 yaha boss bhi pighal gye 😂
@tanmayjain1584
@tanmayjain1584 3 жыл бұрын
Yaar mera to dhyaan bhatak jaata hai ...beech beech may pause kar k bs dil pe haath rakh k hsate rehta hun......kitniiii ppyaari hai ye.... lekin han bahot achcha pdhati hai jenny mam
@kusumjoshi8140
@kusumjoshi8140 3 жыл бұрын
fuck off.. Aditya Verma is best
@sauravdas7591
@sauravdas7591 4 жыл бұрын
Good Explanation Programming Lord! But Bro, please create the remaining ones in the list, really appreciate your hard work for explaining the concepts. I wished my DSA teacher be like you.
@jiteshkumar3112
@jiteshkumar3112 4 жыл бұрын
brother please complete the series by uploading 4 more questions that you gave in your 1 video of stack
@lifeexplorer2965
@lifeexplorer2965 4 жыл бұрын
2:13😂😂
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
😅
@shiwansbhatt1803
@shiwansbhatt1803 4 жыл бұрын
Bahut sundar😂
@AbhishekSharma-ip4df
@AbhishekSharma-ip4df Жыл бұрын
15:51 his laugh after "tho hame samajh a gaya ki hm kaise paani nikal skte h" Ture engineers😂😂 🙌
@ananya_gupta2328
@ananya_gupta2328 7 ай бұрын
"Vo accha pdhati hai, sundar bhi dikhti hai" was heart touching🤣🤣
@ayushagarwal2032
@ayushagarwal2032 4 жыл бұрын
when are you releasing backtracking playlist?
@KartikeyTT
@KartikeyTT 10 ай бұрын
It took him 3 years
@babithakumari5884
@babithakumari5884 Жыл бұрын
can't thankyou enough for these videos, I can't believe I am able to code faster only by understanding the approach.
@iamvishalaggarwal
@iamvishalaggarwal 7 ай бұрын
best explanation 🥳
@youcantgetme1126
@youcantgetme1126 2 жыл бұрын
15:45 so , apne ko smj aa gya ki kese Pani nikal skte h ..😂😂 anyone noticed that he laughed at that moment 😅😅
@mohamedfaizan3095
@mohamedfaizan3095 3 жыл бұрын
2:14 bhaiya op😂😂
@abhineetsingh6720
@abhineetsingh6720 2 жыл бұрын
"jenny kafi acha padhati hai aur sundar bhi dikhti hai"
@vishalkumarshaw9208
@vishalkumarshaw9208 3 жыл бұрын
you are OP aditya Bhai...jenny wala dialouge
@_AmbujJaiswal
@_AmbujJaiswal Жыл бұрын
jenny achha padhati h aur sundar bhi dikhti h🤣🤣🤣🤣
@ajaybhagchandani3307
@ajaybhagchandani3307 4 жыл бұрын
This video helped me in solving the leetcode question of Rain water trapping. Thanks alot!
@aloksingh8851
@aloksingh8851 2 жыл бұрын
I have a doubt here, we didn't use Stacks at all in this solution. I see a stack solution on GFG as well but I can't grasp that, can you please add an explanation for that as well?
@shyamkachhadiya4964
@shyamkachhadiya4964 7 ай бұрын
wow great problem, solved excellents, there's little maths involved but yea great explanation.
@CodeKickstart123
@CodeKickstart123 2 ай бұрын
What an explanation 😊
@Missing_man
@Missing_man Жыл бұрын
2:10 comment on jenny was awesome 😎😎😂😂😂😂😂😂😂😂
@teen350
@teen350 4 жыл бұрын
Suberb explanation😊
@dheerajpoonia2175
@dheerajpoonia2175 4 жыл бұрын
awesome sir, koi word nhi hai apki tarrif krna ka bss jaab selection honne ke baad sweet lekr faculty k pass too pta nhi jaoga ya nhi but appke pass jurur aaoga :-)
@Rajjain_
@Rajjain_ 3 жыл бұрын
sunder bhi dikhti hai who😂, But you are the best!
@deepakffyt2844
@deepakffyt2844 Жыл бұрын
Bhai appse aacha koi nahi padtha KZbin pe ♥️
@anmolsingh3482
@anmolsingh3482 2 жыл бұрын
Great explanation Sir!
@ArpitKumar-yo6up
@ArpitKumar-yo6up 2 жыл бұрын
I love your explanation sir
@nishantingle1438
@nishantingle1438 2 жыл бұрын
There is O(1) space complexity solution to it. This is indeed related to NGL just nearest is changed to farthest. In fact there is no need of stack in NGL, you can just use the same technique to compare with ngl(previous).
@anonymous090
@anonymous090 2 жыл бұрын
how we can solve it in O(1) ??
@kirtikhohal3313
@kirtikhohal3313 2 жыл бұрын
I don't think we can say this as farthest greater to left: suppose this is the array: 6 8 0 0 5 9 6 for element=5 max in the left array is 8 max in the right array is 9 min of both is 8 water accumulated on element =5 is 8-5=3. which is correct. But, farthest greater to left is 6 farthest greater to right is 9 min is 6 water accumulated is 6-5 =1, which is wrong
@lakshkumrawat140
@lakshkumrawat140 2 жыл бұрын
15:48 kese pani nikal sakte he , and that laughter explains all 😂😂
@MasoomSahu-q4z
@MasoomSahu-q4z Жыл бұрын
And jenny sundar h 🤣🤣🤣
@roshangupta8161
@roshangupta8161 Жыл бұрын
15:50 Bro didn't even hesitate!! 😂😂
@sudipasarkar7981
@sudipasarkar7981 4 жыл бұрын
areeey you're the best ..i can binge watch your videos
@aditya-bl5xh
@aditya-bl5xh 3 жыл бұрын
Get a life
@subarnasamanta4945
@subarnasamanta4945 3 жыл бұрын
Attitude tabar tor hai bhai sahi hai dikhra hai kis level ka preparation hai aur really approach kafi different aur accurate hai
@manaligupta5332
@manaligupta5332 4 жыл бұрын
The current solution is O(N), O(N) for time and space complexity respectively. A more optimized solution exists using constant extra space O(N), O(1).
@yoyocontact5181
@yoyocontact5181 3 жыл бұрын
can you please help me ? I wrote the whole code but it is giving me segmentation fault , i cant find where is the mistake #include #include #include using namespace std; #include int trap(vector& height) { vectormaxl; vectormaxr; maxl[0]=height[0]; for ( int i =1;i=0;i--) { maxr[i]=max(maxr[i+1],height[i]); } vectorwater; for ( int i =0;i
@ajitdhayal1612
@ajitdhayal1612 4 жыл бұрын
Jenny kafi achchha padati hai +sunder bhi dikhti hai! Sir aapka crush hai sayad😂
@TheAdityaVerma
@TheAdityaVerma 4 жыл бұрын
Tum log badnaam mt kro be, 😂😂 tum logo interest aaye isliye bola tha yaar, yaha to backfire ho gya 😕😅
@Anand-zg6jv
@Anand-zg6jv 4 жыл бұрын
Bhai or SB topic pe videos dalo na .... Bhut Shi samjh Mai aata tumhari video se
@mrinalkhandelwal9631
@mrinalkhandelwal9631 4 жыл бұрын
Sir, please upload videos on graph problems: DFS, shortest paths, SCC
@abhishekaggarwal7110
@abhishekaggarwal7110 Жыл бұрын
one line for Jenny 😂 kaafi acha pdhati hai and sundar bhi dikhti hai 😂
@be_like__prateek
@be_like__prateek 4 жыл бұрын
was expecting the approach using stack. It's nowhere in the utube. DP approach is explained by everyone as it is easy.
@kirtikhohal3313
@kirtikhohal3313 2 жыл бұрын
no doubt , he gave an amazing explanation, but we didn't used stack in this solution, then what's the point of adding this question in the stack playlist?
@strangesoul31
@strangesoul31 3 жыл бұрын
Still Waiting for Tree,Graph, Backtracking... Bhai apko jab bhi time mile to inki video series bana ke upload kr dena🙏🙏🙏
@vasupatel635
@vasupatel635 4 жыл бұрын
You are doing great job. aditya. Thanks man.
@sbrmnd3885
@sbrmnd3885 4 жыл бұрын
Waiting eagerly for your backtracking playlist. Please release it soon.
@chandankrjha
@chandankrjha 3 жыл бұрын
itna acche se explain kiya hai. dhanyawaad.
@yoyocontact5181
@yoyocontact5181 3 жыл бұрын
can you please help me ? I wrote the whole code but it is giving me segmentation fault , i cant find where is the mistake #include #include #include using namespace std; #include int trap(vector& height) { vectormaxl; vectormaxr; maxl[0]=height[0]; for ( int i =1;i=0;i--) { maxr[i]=max(maxr[i+1],height[i]); } vectorwater; for ( int i =0;i
@pratik.784
@pratik.784 Жыл бұрын
stack kha use hua isme?
@tanzeelurrahman1545
@tanzeelurrahman1545 3 жыл бұрын
Add link to problem in your videos. TY for the amazing tutorials.
@harshtiwari1397
@harshtiwari1397 4 жыл бұрын
Thanks sir , please keep uploading as these are very useful videos.
@sagardas4569
@sagardas4569 4 жыл бұрын
Btw very good concept i understand through this ❤️❤️
@uthsyabmandal2258
@uthsyabmandal2258 3 жыл бұрын
GOD BLESS YOU BHAI
@simrankureel94
@simrankureel94 3 жыл бұрын
You will very soon have 1M subscribers.
@muttanashivasaikumar8763
@muttanashivasaikumar8763 2 жыл бұрын
amazing explanation bhayya..... thank you. and please share the pdf of the notes and ur explationation
@aishwaryadwani9365
@aishwaryadwani9365 4 жыл бұрын
Now are the days when i search about any topic then i type this -> rain water trapping aditya verma... #God
@mainaksanyal9515
@mainaksanyal9515 4 жыл бұрын
Bhai stack kaha use kiya issme ??
@samareshms4591
@samareshms4591 4 жыл бұрын
Apke video ko bc kaun bewakoof insaan dislike kar raha hai Kitne acche padha rahe ho aap Aapko jitna like diye toh bhi kam padega THANK YOU BHAYYA!! Keep helping us
@mohitsoni4352
@mohitsoni4352 3 жыл бұрын
jenny fan honge :)
@adityamane9312
@adityamane9312 3 жыл бұрын
what will be the time and space complexity for this problem??
@AmanKumar-kz1rn
@AmanKumar-kz1rn 4 жыл бұрын
samshj me agya kaise pani nikalna hai thanks bhaiya for such a wonderfull explanation
@ayushbisht2689
@ayushbisht2689 4 жыл бұрын
Loved your way of explaining .
@Prodcater
@Prodcater 3 жыл бұрын
@adityaverma Please discuss the time complexity also for each program ..please it will help a lot
@RahulVerma-fz2jf
@RahulVerma-fz2jf 4 жыл бұрын
Upvoting because you explained it well, but the video pic (in the starting) mentions, you will be solving it using stack, but you didn't. Please add the stack solution as well.
@jaydeepmahajan6598
@jaydeepmahajan6598 4 жыл бұрын
Explanation is really good but i didn't see stack in this problem
@akashbhoi1951
@akashbhoi1951 3 жыл бұрын
Sundar bhi dikhti hai woh😂🥰🥰
@dashrathsinghkaviya
@dashrathsinghkaviya 3 жыл бұрын
15:52 That Laughter 😂
@tanmaymalhotra4450
@tanmaymalhotra4450 3 жыл бұрын
Finally Understood, Thank you Bhaiyya !!
@harshvardhanyadav8949
@harshvardhanyadav8949 3 жыл бұрын
Amazing explanation sir ,you make this problem a lot easy
@jitengarg5740
@jitengarg5740 3 жыл бұрын
bhai bohot badiya thi vedio :) pr avaj bohot kam hai jis karan earphone lagane pad te hai aur jada time earphone lagane muskil hai
@ShreyaSingh-vr9qi
@ShreyaSingh-vr9qi 4 жыл бұрын
Nice explaination !!
@ajitpai1852
@ajitpai1852 4 жыл бұрын
Nice videos. Video ka volume bahut kam ata hai. Please thoda volum jyada rakhiye
@PankajGupta-vs2kq
@PankajGupta-vs2kq 4 жыл бұрын
Time complexity using this method and using stacks is O(n), right?
@047gauravkumartiwari5
@047gauravkumartiwari5 3 жыл бұрын
Bhaiya mic mars pe rakh ke earth pe video record kar rahe ho kya.
@piyushkumar-bl2ck
@piyushkumar-bl2ck 3 жыл бұрын
Thanks Aditya . Constant space - O(1). and single loop solution - O(n) void max_water(int A[], int n) { int l = 0, h = n - 1; int left_max = 0; int right_max = 0; int ans[n] = {0}; while (l = right_max) { right_max = A[h]; } else ans[h] = right_max - A[h]; h--; } } for (int i = 0; i < n; i++) { cout
@kirtikhohal3313
@kirtikhohal3313 2 жыл бұрын
Is it the dp solution??
@aryankhanuja4828
@aryankhanuja4828 2 жыл бұрын
@@kirtikhohal3313 Dp can not be done without memoisation. This is greedy ig..
10 Minimum Element in Stack with Extra space
18:08
Aditya Verma
Рет қаралды 97 М.
6 Stock Span Problem
28:02
Aditya Verma
Рет қаралды 224 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
7 Maximum Area Histogram | MAH
35:00
Aditya Verma
Рет қаралды 216 М.
Kth Symbol in Grammar
23:32
Aditya Verma
Рет қаралды 128 М.
Trapping Rain Water - Google Interview Question - Leetcode 42
23:21
The Most Misunderstood Concept in Physics
27:15
Veritasium
Рет қаралды 18 МЛН
L8. Trapping Rainwater | 2 Approaches | Stack and Queue Playlist
28:58
CompTIA A+ Certification Video Course
3:50:46
PowerCert Animated Videos
Рет қаралды 7 МЛН
Trapping Rainwater | Brute | Better | Optimal | with INTUITION
23:23
take U forward
Рет қаралды 284 М.
11 Minimum Element in Stack in O(1) Space
26:58
Aditya Verma
Рет қаралды 115 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19