Trapping Rain Water | O(N) Time complexity and O(N) Space Complexity Geeksforgeeks Leetcode Solution

  Рет қаралды 20,020

Hello World

Hello World

Күн бұрын

Пікірлер: 161
@Srimudit
@Srimudit 3 жыл бұрын
If I want to look for any solution for DS questions, default YT channel is yours. If it is not available, then I look for other channels. Please don't stop making DS question videos. One of the best solutions,
@khanf13
@khanf13 4 жыл бұрын
Your slow and soft way of explaining is really pleasent to hear!
@gokulnaathb2627
@gokulnaathb2627 3 жыл бұрын
Exactly😭💖
@CSBDPSAHITHIRANI
@CSBDPSAHITHIRANI 3 жыл бұрын
Wow such an elegant solution without using any stacks and all. Thank you so much!!
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Keep learning buddy ❤️ And sharing my channel with your friends and colleagues
@divypareek8230
@divypareek8230 2 сағат бұрын
Sir thank you so much for your explanations , the visualisation of the problem and the dry run you did for the question were enough for me to solve the whole question
@RavindraKadam-ri4xp
@RavindraKadam-ri4xp Жыл бұрын
you are explaining very well, till now I have watched only 2 videos of you both are having hard questions but when I saw your video. I thought is it hard, no because you explained it very well hence it became an easy question for me.
@shivangitiwari8252
@shivangitiwari8252 3 жыл бұрын
The way you explain is great , so systematic with proper concepts and explanations . Literally loved your videos.
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks Shivangi for such a wonderful appreciation
@rdxgaurav3483
@rdxgaurav3483 2 жыл бұрын
Bhai itna aaram se samjhate ho na hard problem bhi acche se samajh ata hai, Really you have this art.
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks yaar 😍
@kuldeepsingh-oz4om
@kuldeepsingh-oz4om Жыл бұрын
@@HelloWorldbyprince but after two years(i.e now ) this solution show error :- " Segmentation Fault (SIGSEGV) " i.e it has to be more optimized
@rupeshjha4717
@rupeshjha4717 3 жыл бұрын
One of the best explanations! Please continue making such videos sir!
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Sure buddy
@rajjaiswal8768
@rajjaiswal8768 Жыл бұрын
bhaiya i think u are the most underrated youtuber in this field, i have watched your playlist on hashing and it really helped me a lot and some on BST, thanks bhaiya , RESPECT for you.
@shaikkhajamohiddin4035
@shaikkhajamohiddin4035 4 жыл бұрын
till now i have seen 5 videos regarding this concept but no such video has a good explanation like urs video.........bhai we need this type of explanation like explaining the question properly and the concept behind it and finally code explanation.....keep it up bro do the upcoming videos like this, its a request!!! Thank you bro
@mithileshsharma6878
@mithileshsharma6878 2 жыл бұрын
same bro
@ankushladani496
@ankushladani496 2 жыл бұрын
Samaj me aa gaya bhaiya...💯💯
@maheshnv4848
@maheshnv4848 4 жыл бұрын
I think We can solve this in o(1) space using two pointer approach lmax,rmax=arr[0],arr[-1] l,r=0,n-1 Count=0 While l
@CodingWithPrakash_
@CodingWithPrakash_ 4 жыл бұрын
Yes
@abhijeetghubade994
@abhijeetghubade994 4 жыл бұрын
Thank you soo much, I liked the way you thought to improve the time complexity. Great Explanation. Thank you soo much. I have watched all your videos
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks for your support ... Please keep sharing with your friends
@alfiyazahra4680
@alfiyazahra4680 3 жыл бұрын
aa gaya bhaiya samjh I really appreciate ur efforts
@shreyankshrestha9274
@shreyankshrestha9274 3 жыл бұрын
samjha diya bhai bahut bahut sukriya .
@subhajitpaul1260
@subhajitpaul1260 4 жыл бұрын
Really clear explanation 😍
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks buddy
@ankitvijay8985
@ankitvijay8985 2 жыл бұрын
Great explanation ✨
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks a lot yaara ❤️
@Rajnish-pu8mj
@Rajnish-pu8mj 7 ай бұрын
sir you are a gem !!!!!!
@Neeraj-q9y9z
@Neeraj-q9y9z Жыл бұрын
Excellent Explationation 🎉🎉
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks a lot
@mitpatel2420
@mitpatel2420 Жыл бұрын
bhai explaination level is op
@khanf13
@khanf13 4 жыл бұрын
BEST SOLUTION ON THE WEB FOR THIS QUESITONS !!!!!! Wow bhai i am ur fan ! tysm
@arkabhattacharya7743
@arkabhattacharya7743 3 жыл бұрын
Your explanation is the best for beginners keep it up!!!
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks a lot buddy 😀
@kamalsingh1345
@kamalsingh1345 Жыл бұрын
Great 👍👍👍❤
@akshita5472
@akshita5472 4 жыл бұрын
Good explanation👍👍
@abhishekkumaryadav652
@abhishekkumaryadav652 4 жыл бұрын
Now I am get the complete concept of trapping rain water thanks sir
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Kindly share my channel with your friends and on social media
@namankumarsharma5195
@namankumarsharma5195 Жыл бұрын
Good explanation for solving this question in O(n) 👍🔥 . I had tried to solve this in O(n) but my program was give wrong output on some testcase.
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks a lot please share my channel with your friends
@shashwatsingh253
@shashwatsingh253 3 жыл бұрын
Dhanyavad Bhaiya For Great Explanation of O(n) approach . . . .
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Keep sharing my channel ❤️❤️ in your social media group
@shashwatsingh253
@shashwatsingh253 3 жыл бұрын
@@HelloWorldbyprince Jii Bhaiya Sure
@sarahdaniel6862
@sarahdaniel6862 4 жыл бұрын
Thank you so much!! The explaination of the logic and code is very clear. 👏👏
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks 😊 Keep sharing with your friends
@nikhilsatyam4815
@nikhilsatyam4815 2 жыл бұрын
bhaiya samjh me aagya 😀😀
@manishreddy9799
@manishreddy9799 2 жыл бұрын
perfect explanantion hatsoff
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks a lot buddy
@Being_dodo
@Being_dodo Жыл бұрын
this man izz simply great!!!
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks a lot
@tarunbehera934
@tarunbehera934 Жыл бұрын
thank you so much for solving tough problems like this in the easiest way possible.🙏🙏
@MindFlayer3012
@MindFlayer3012 Жыл бұрын
SUCH A NICE EXPLAINATION BHAIYA
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks a lot
@AmanKumar-sf7zi
@AmanKumar-sf7zi 3 жыл бұрын
Got it sir...
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Great buddy
@ritikadhangar2979
@ritikadhangar2979 Жыл бұрын
thankyou so much sir😇😇😇😇😇
@prem-i7h
@prem-i7h 4 жыл бұрын
You are great 🙌🙌🙌
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Thanks 😊😊
@kuldeepsingh-oz4om
@kuldeepsingh-oz4om Жыл бұрын
@@HelloWorldbyprince but after two years(i.e now ) this solution show error :- " Segmentation Fault (SIGSEGV) " i.e it has to be more optimized
@magic.pencil2.0
@magic.pencil2.0 2 жыл бұрын
Very neat explanetion broo. Keep uploading such videos. Thanks
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Keep watching
@090_srishtigaur8
@090_srishtigaur8 Жыл бұрын
finally smjh aa gya
@vidyamusic6794
@vidyamusic6794 Жыл бұрын
u make things really very easy for us thanks again
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks a lot
@omkarmore6167
@omkarmore6167 4 жыл бұрын
Bhaiya bahut badiya.....keep it up !!!!!!!!!!!!!!!!
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Keep sharing with your friends ❤️
@pallavi_10
@pallavi_10 Жыл бұрын
u r the best thank u
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
You're welcome!
@vHarshita15
@vHarshita15 4 ай бұрын
Very nice
@sujoyseal195
@sujoyseal195 4 жыл бұрын
Kaafi achha explanation hai
@aqsaaqeel8665
@aqsaaqeel8665 3 жыл бұрын
Nice explanation
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks 😊
@adityagulhane7271
@adityagulhane7271 2 жыл бұрын
bohot sahi bhai!!!
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks Aditya Please, if possible then share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@dhanashreegaikwad6560
@dhanashreegaikwad6560 4 жыл бұрын
Great explanation!!
@SagarDas-le8if
@SagarDas-le8if 11 ай бұрын
Very Thanks bhaiya The way you explain concept that it amazing , other also do this but you are unique 🙃😀
@HelloWorldbyprince
@HelloWorldbyprince 11 ай бұрын
Thank you so much 😀
@entertainmentworld5276
@entertainmentworld5276 4 жыл бұрын
Thank you so much!!
@rhythmmahale4183
@rhythmmahale4183 Жыл бұрын
very clear explanation
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Keep watching
@suhelali4547
@suhelali4547 2 жыл бұрын
thanks a lot sir
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Keep learning buddy 😊 Please, if possible then share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@sakshamsinha6436
@sakshamsinha6436 4 жыл бұрын
Great explaination ,Sir❤️🙏
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Keep sharing with your friends
@kashmiramathur8673
@kashmiramathur8673 3 жыл бұрын
absolutely great efforts...hats off
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks a lot
@peacefulpeace9572
@peacefulpeace9572 3 жыл бұрын
great work sir
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks bhai Bass share kardo channel ko aap mere motivation ke liye 🥰
@ANUJKUMAR-fu4bk
@ANUJKUMAR-fu4bk 3 жыл бұрын
Whenever I'm unable to solve any problem. I'm searching on HW Because here I get best solution 👍.
@uniqueshivam
@uniqueshivam 4 жыл бұрын
Thankyou for your awesome explaination.🔥 Keep it up👍👍
@nimssinha5373
@nimssinha5373 4 жыл бұрын
Nice explanation brother✌
@SOURAVKUMAR-di4xg
@SOURAVKUMAR-di4xg 4 жыл бұрын
Great Work...
@Sudhirkumar-sz3pu
@Sudhirkumar-sz3pu 2 жыл бұрын
Bhaiya bhot maja aa gya 😎😎 thank you 🙏🙏
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks a lot Please , if possible then share this channel in your college, groups or linkedin becoz it's cost nothing to you 😀
@kuldeepsingh-oz4om
@kuldeepsingh-oz4om Жыл бұрын
@@HelloWorldbyprince but after two years(i.e now ) this solution show error :- " Segmentation Fault (SIGSEGV) " i.e it has to be more optimized
@AJAYKumaryadav-fj2lc
@AJAYKumaryadav-fj2lc 4 жыл бұрын
Great
@bhupeshpattanaik7150
@bhupeshpattanaik7150 4 жыл бұрын
6:20 half video complete hone ke baad check kar rahe ho ki video record hori hae ya nahi ..... lol nice video , because record ho gyi hae ;-)
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
😀😀
@utsavkumarmalviya5041
@utsavkumarmalviya5041 2 жыл бұрын
Very well explain
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Thanks for liking
@faizalam355
@faizalam355 3 жыл бұрын
U should do it in O(1) in space complexity
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
ok i will try this also
@darshankalathiya8667
@darshankalathiya8667 2 жыл бұрын
Grat sir..
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
nice bro
@ishitasrivastava6976
@ishitasrivastava6976 Жыл бұрын
Wonderful
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thank you! Cheers!
@rdxgaurav3483
@rdxgaurav3483 2 жыл бұрын
Please also make video on Container with most water , leetcode problem
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
okay sure i will
@Maheshwaripremierleague
@Maheshwaripremierleague Жыл бұрын
maza aagya solve krke
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks yaar ❤️ please share and support my channel
@UpscWithPavanOfficial
@UpscWithPavanOfficial 8 ай бұрын
Nice
@KunalKashyap6
@KunalKashyap6 2 жыл бұрын
Thanku
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
welcome
@Aman-dx1vl
@Aman-dx1vl 2 жыл бұрын
thankyou sir..
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Most welcome Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@sukhjeetkaur15
@sukhjeetkaur15 4 жыл бұрын
👍👍
@namratadhobale7051
@namratadhobale7051 2 жыл бұрын
amazing
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Please, share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@divyanshgupta3126
@divyanshgupta3126 8 ай бұрын
@mithileshsharma6878
@mithileshsharma6878 2 жыл бұрын
bhai apko ek youtube channel shuru krna chaiye uspr video dalni chaiye ap smjhate bhot vdia ho
@blackerhat
@blackerhat 2 жыл бұрын
maja aa gya
@suseelas9736
@suseelas9736 2 жыл бұрын
is this code in priority queue
@Srimudit
@Srimudit 3 жыл бұрын
Goldman Sachs asked the same question when it visited our campus
@intromaker400
@intromaker400 Жыл бұрын
Kya ye channel java ke liye suitable ha
@sanyamshaw7584
@sanyamshaw7584 2 жыл бұрын
I am confused. We are using two arrays lmax and rmax doesn't that implies space complexity is O(2N)
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
yess but it is considere as O(N)
@kuldeepsingh-oz4om
@kuldeepsingh-oz4om Жыл бұрын
@@HelloWorldbyprince but after two years(i.e now ) this solution show error :- " Segmentation Fault (SIGSEGV) " i.e it has to be more optimized
@anuskamishra_cseiot_6035
@anuskamishra_cseiot_6035 10 ай бұрын
long long trappingWater(int arr[], int n){ // code here int water = 0; for(int i=1; i
@harshalsangame1305
@harshalsangame1305 3 жыл бұрын
7 8 8 2 4 5 5 1 why this input is not accepting in gfg in shows me wrong ans ?
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Sometimes gfg shows wrong Check your code in copy == check code in local computer If same then u r right Tumhara logic sahi hai agar then fine
@chidambarjoshi3470
@chidambarjoshi3470 4 жыл бұрын
bro , the videos are not properly synced with your voice ...
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
Yup ...due to my mobile 😌
@chidambarjoshi3470
@chidambarjoshi3470 4 жыл бұрын
@@HelloWorldbyprince bro can u please explain how to get summer internship at IITs in detail , I am in 5th sem and in 2021 I want to apply for internship at IIT and how to choose an area of interest...please!!
@abhijeetghubade994
@abhijeetghubade994 4 жыл бұрын
@@chidambarjoshi3470 You can go to IIT college's websites and in the see which prof is working on what project and then you can mail them stating how you can contribute to their projects.. They might reply you and ask for an interview or talk about what he expects from you. Also, every IIT has or most of the IIT had their own program for their respective institute. You can apply through that too. The programs are kinda CGPA centric soo getting through it might be a little difficult PS - I did my 2nd year internship at IITM CSE Department by mailing. I didn't have luck with programs
@chidambarjoshi3470
@chidambarjoshi3470 4 жыл бұрын
@@abhijeetghubade994 while applying got internship at any IIT , do they really make you to explain the related projects if u have any , and letter of recommendation from HOD of our current institute , CV. Did u get internship by giving an interview to that professor?
@abhijeetghubade994
@abhijeetghubade994 4 жыл бұрын
@@chidambarjoshi3470 I got the internship by mailing profs. The prof may or may not take an interview. It depends on the prof. My prof took an interview. Start mailing profs from December or January for summer 2021. Till then you can try to built some mini project of yours so that you have something to show him as in what you have done. Letter of recommendation isn't very necessary. If the prof asks for one, you might have to take one from your HoD. If you are planning on applying through any program, you will definitely need an LoR from one of your prof. CV is obviously needed.
@harshgarg2146
@harshgarg2146 Жыл бұрын
error aa rhi hai
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Pls try to see my code and ya fir code ko dry run karke dekho aap
@harshgarg2146
@harshgarg2146 Жыл бұрын
Btao kaise solve kru
@harshgarg2146
@harshgarg2146 Жыл бұрын
1 hour tk try Kiya esse bdya love babar hai best tarika se smjhta hai
@harshgarg2146
@harshgarg2146 Жыл бұрын
@@HelloWorldbyprince okk wait
@gauravparasar4571
@gauravparasar4571 Жыл бұрын
2 test case pass nahi hore
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
kon kon se ?
@gauravparasar4571
@gauravparasar4571 Жыл бұрын
@@HelloWorldbyprince are sir password yaad agya apko 🤣
@shashanksabharwal8591
@shashanksabharwal8591 4 жыл бұрын
One more day gone.. But aaj bhi koi video nahi aai 😭😭😭😭😭😭... Bhai pada do na... Dailyy k 4-5 question
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
I am glad that you are waiting for my videos ...but I feel bad...becoz my phone is not working ...but hopefully I upload my video today 😌
@shashanksabharwal8591
@shashanksabharwal8591 4 жыл бұрын
@@HelloWorldbyprince 😣😣😣 Bhai ummide mt todo yrrrr.. Itna slow video... Bhai aaj bhi nahi aai... Yr din ki 3 dal do please 🙏🙏🙏🙏🙏🙏🙏 acche acche medium level questions .. From gfg /leetcode Please 😭 Lockdown h khi coaching bhi nahi ja skta .. Please bhai.. Thoda or effort marke thodi jldi videos dalo Ye ek Iklota yt channel h jo wakai m pura code detail m smjhakr, even write bri krte ho code...
@raunakkumar6144
@raunakkumar6144 2 жыл бұрын
bro 132 test case didnt pass long long trappingWater(int arr[], int n){ // code here int left[n]; left[0]=arr[0]; int right[n]; right[n-1]=arr[n-1]; int water_trapped=0; for(int i=1;i=0;i--) { right[i]=max(arr[i],right[i+1]); } for(int i=0;i
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
why bro ? can u please debug by dry run
@dakshchandra5607
@dakshchandra5607 2 жыл бұрын
at 132 test case this solution get wrong ans!!!!!!!!! in 2023
@bhupeshpattanaik7150
@bhupeshpattanaik7150 4 жыл бұрын
1 suggestion .... try to improve your body language and energy level of speaking , this might help you in increase your audience
@HelloWorldbyprince
@HelloWorldbyprince 4 жыл бұрын
I really appreciate your suggestions
@ankitvijay8985
@ankitvijay8985 2 жыл бұрын
Great explanation ✨
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Keep learning buddy Please, if possible then share this channel in your college, groups, or LinkedIn bcoz it's cost nothing to you 😀
@abhishekgovind5174
@abhishekgovind5174 Жыл бұрын
Good explanation
@sukritimaurya2600
@sukritimaurya2600 Жыл бұрын
Nice explanation 🙌
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Trapping Rainwater Problem | Leetcode #42
34:12
Techdose
Рет қаралды 100 М.
Trapping Rain Water - Google Interview Question - Leetcode 42
23:21