Trapping Rainwater Problem | Leetcode #42

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ต.ค. 2024

ความคิดเห็น • 248

  • @TW-uk1xi
    @TW-uk1xi 3 ปีที่แล้ว +66

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

  • @EngWorld-nr2ww
    @EngWorld-nr2ww 3 ปีที่แล้ว +73

    Your patience while explaining is quite appreciable

  • @gsmdfaheem
    @gsmdfaheem 2 ปีที่แล้ว +7

    Hands down the best explanation on youtube... Better than top creators.

  • @mwshubham
    @mwshubham 3 ปีที่แล้ว +30

    This might be the longest video on your channel. Very well covered. Thank you :)

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +2

      Welcome

    • @abhilashpatel3036
      @abhilashpatel3036 3 ปีที่แล้ว +1

      i did not even notice. Time flies.

    • @MdOwaisUmar
      @MdOwaisUmar 2 ปีที่แล้ว

      @@abhilashpatel3036 Absolutely, Time flies, but leaves its shadow behind.

  • @大盗江南
    @大盗江南 3 ปีที่แล้ว +6

    After finding ur videos, i never watch any other channel.... i super like how u explain stuff, and different improved ways to solve it. thank you man!

  • @rtan8780
    @rtan8780 3 ปีที่แล้ว +16

    Dang man, you made a Leetcode Hard problem seem like an Easy. Subscribed :)

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +1

      👍🏼

    • @muwongenicholus2444
      @muwongenicholus2444 2 ปีที่แล้ว

      Hehehe, I was thinking the same thing. Some people are natural teachers.

  • @codingessential91
    @codingessential91 3 ปีที่แล้ว +8

    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.

  • @saleheen12
    @saleheen12 24 วันที่ผ่านมา

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

    • @techdose4u
      @techdose4u  24 วันที่ผ่านมา

      great :)

  • @gautam4696
    @gautam4696 3 ปีที่แล้ว +2

    The solution of this problem is very simple but the way sir tells how to approach a problem is amazing .

  • @sugandhaduhan8707
    @sugandhaduhan8707 ปีที่แล้ว

    Best video on internet for Trapping Rain water.. I wouldn't have understood this problem if I hadn't found this video... Kudos for the great explanation....

  • @amitavamozumder73
    @amitavamozumder73 3 ปีที่แล้ว +2

    It's rare to have a video with zero downvotes! great explanation.

  • @paramitagorai9087
    @paramitagorai9087 2 ปีที่แล้ว +1

    Generally dont prefer commenting unless really impressed. This was a great solution and I could code very easily myself. thanks for all the effort spent.

  • @shantanusharma184
    @shantanusharma184 2 ปีที่แล้ว +2

    Your explanation resolved all my doubts and i was able to write code by myself after watching your video for 10 minutes.
    Thank you

  • @suryajena1575
    @suryajena1575 3 ปีที่แล้ว +2

    Happy Teacher's day. Really appreciate you as a teacher.

  • @stephc4925
    @stephc4925 2 ปีที่แล้ว +6

    One of the best explanations! Thanks a lot!

  • @YashHalgaonkar
    @YashHalgaonkar 3 ปีที่แล้ว +4

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

  • @01kumarr
    @01kumarr ปีที่แล้ว

    giving all three possible solutions u make life easy. Thanks a lot

  • @PRUTHVIRAJRGEEB
    @PRUTHVIRAJRGEEB 3 ปีที่แล้ว +2

    This is hands down the best explanation I have seen for this question. I am surprised it doesn't have many views!

  • @DK-ox7ze
    @DK-ox7ze 3 ปีที่แล้ว +4

    Awesome explanation, covering all cases with detail and clarity!

  • @mridulsemwal1396
    @mridulsemwal1396 2 ปีที่แล้ว +2

    No one explains like this.
    Loved your videos

  • @biswajitsingh8790
    @biswajitsingh8790 2 ปีที่แล้ว

    Hands down the best explanation of this problem on the internet. 🙏🙏

  • @muwongenicholus2444
    @muwongenicholus2444 2 ปีที่แล้ว +1

    You sir, did an awesome job breaking this down and making it simpler to understand. Thank you for your efforts. Appreciate it

  • @PRASHANTKUMAR-xs9pk
    @PRASHANTKUMAR-xs9pk 3 ปีที่แล้ว +1

    In every Questions , too much concept as well as hidden cases . When i want to try same questions after 4 days or a week i got stuck but your explanation make question easier for me. ::))

  • @flyingcanopy5611
    @flyingcanopy5611 3 ปีที่แล้ว +1

    I watched many videos to understand the concept of two pointer approach.. But after watching this video, It became so clear to me.... Next time if I am unable to solve any question I will come to this channel first... This is a very underrated channel..

  • @kushagrashekhawat8227
    @kushagrashekhawat8227 3 หลายเดือนก่อน

    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.

    • @techdose4u
      @techdose4u  3 หลายเดือนก่อน +1

      thanks :)

  • @ajaygonepuri2285
    @ajaygonepuri2285 ปีที่แล้ว +1

    You Deserve more than a million subscribers for such a great content!

  • @chandrachurmukherjeejucse5816
    @chandrachurmukherjeejucse5816 ปีที่แล้ว

    So far the best explaination. Thank you so much sir.

  • @ravikumar-kh9gi
    @ravikumar-kh9gi 3 ปีที่แล้ว +1

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

  • @harikakiran18
    @harikakiran18 3 ปีที่แล้ว +1

    Nicely explained step by step, appreciated it, understood the approach in one go...you deserve more subs & views...hope you will reach there ..:)

  • @nishantpratyush4191
    @nishantpratyush4191 2 ปีที่แล้ว +1

    I bet this vdo has got the best explanation for the two pointer approach...thanks a ton TechDose😊

  • @jiosim1377
    @jiosim1377 3 ปีที่แล้ว +1

    Thanks alot! I was struggling to understand the logiv but now its clear

  • @MohitKumar-rq8hv
    @MohitKumar-rq8hv 2 ปีที่แล้ว +1

    TC =O(n)
    SC =O(1)
    => 24:25
    superb explaination

  • @manojbhatt8424
    @manojbhatt8424 ปีที่แล้ว +2

    brooooooooooooooooo best explaination ever

  • @huansir1922
    @huansir1922 2 ปีที่แล้ว +1

    thank you for your explain , from simple solution to better solution !

  • @ayushsrivastava830
    @ayushsrivastava830 2 ปีที่แล้ว +1

    Awesome Explanation, better from other TH-camrs

  • @neerajpandey7273
    @neerajpandey7273 3 ปีที่แล้ว +2

    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

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +1

      😂 hahaha. Very nice to see you apply the concepts of my previous video :) But there is always someone better than you 😉

    • @neerajpandey7273
      @neerajpandey7273 3 ปีที่แล้ว +1

      @@techdose4u =D =D

  • @sanketgupta9831
    @sanketgupta9831 2 ปีที่แล้ว

    Best explanation ever with best level of calmness and patience 😊😊

  • @sukeshreddy2286
    @sukeshreddy2286 2 ปีที่แล้ว

    You are the best. I am now sharing with my friends!!

  • @harishkandikatla9791
    @harishkandikatla9791 3 ปีที่แล้ว +1

    Excellent explanation!
    Your channel will definitely grow a lot

  • @beginnerprogrammingtutoria5053
    @beginnerprogrammingtutoria5053 3 ปีที่แล้ว +1

    An incredibly detailed and amazing presentation. Thank you!

  • @coderart__2802
    @coderart__2802 3 ปีที่แล้ว +1

    Thanks for this beautiful video, your explanation made me code myself... At the end of 16 min of the video, I understood and coded in python.

  • @venup2813
    @venup2813 2 ปีที่แล้ว

    Most underrated channel

  • @NaveenRawat51
    @NaveenRawat51 3 ปีที่แล้ว +1

    awesome explanation, the way you explained corner cases are great. keep it up

  • @hnsc1
    @hnsc1 3 ปีที่แล้ว +2

    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 :)

  • @nikitakushwaha9572
    @nikitakushwaha9572 2 ปีที่แล้ว +1

    You are very easy and nice to understand.

  • @aniketroy03
    @aniketroy03 3 ปีที่แล้ว +2

    Great video sir!! What an explanation! Keep uploading such videos 🙏🙏

  • @sumeetchawla3545
    @sumeetchawla3545 2 ปีที่แล้ว

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

  • @varshaprajapati6566
    @varshaprajapati6566 2 ปีที่แล้ว

    thankyou so much for this video! you just made this hard task quite easy.

  • @kambalavijay6800
    @kambalavijay6800 2 ปีที่แล้ว

    Techdose to me is a game changer

  • @rajivsarkar277
    @rajivsarkar277 3 ปีที่แล้ว +1

    Ur patience is appreciable

  • @akashjain4281
    @akashjain4281 3 ปีที่แล้ว

    The best explanation for the problems, Ty sir for ur patience and amazing explanations

  • @pkboolean
    @pkboolean 3 ปีที่แล้ว +4

    thank you for this, this is extremely well explained

  • @PujaKumari-rp5sg
    @PujaKumari-rp5sg 2 ปีที่แล้ว

    sir you explained very nicely step by step 👌👌👌

  • @chhavimishra3469
    @chhavimishra3469 2 ปีที่แล้ว

    When the content is so good, subscribing and liking are on autopilot.

  • @basiljacob3894
    @basiljacob3894 3 ปีที่แล้ว +1

    Very well explained sir , your explanation for this question is crystal clear. I really liked this problem it was very intuitive

  • @calisthenics-
    @calisthenics- 3 ปีที่แล้ว

    Champ tech dose🙏 👏
    Well done

  • @yashkhandelwal6588
    @yashkhandelwal6588 3 ปีที่แล้ว +1

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

  • @gamingKlips99
    @gamingKlips99 3 ปีที่แล้ว +3

    what a coincidence that we both were working on the same problem.

  • @sumit180288
    @sumit180288 2 ปีที่แล้ว +1

    Very good explanation

  • @simrankak7045
    @simrankak7045 3 ปีที่แล้ว +1

    amazing crystal clear
    explaination

  • @ravisankarmaruramesh8112
    @ravisankarmaruramesh8112 3 ปีที่แล้ว +3

    Index starts from 1 to arr.len-1
    Totalwater+=Math.min(leftmax of current index element, rightmax of current index element)-current index element

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว +3

      Nice 1 liner :)

  • @TheBikerDude2024
    @TheBikerDude2024 หลายเดือนก่อน

    Excellent explaining.

  • @rachanasingh7047
    @rachanasingh7047 3 ปีที่แล้ว +1

    Best solution explaination to this problem. 🙌

  • @gurubalaji5611
    @gurubalaji5611 3 ปีที่แล้ว +1

    Great explanation sir..hope expecting more videos from tech dose..

    • @techdose4u
      @techdose4u  3 ปีที่แล้ว

      Sure. I will keep uploading :)

  • @playing_rhythms2660
    @playing_rhythms2660 3 ปีที่แล้ว

    I think in the last condition it will be (l

  • @Harsh-og5xr
    @Harsh-og5xr ปีที่แล้ว

    loved that o(1) space method

  • @harshavarthinivr9688
    @harshavarthinivr9688 3 ปีที่แล้ว +1

    Very nice explanation 👌thank youu

  • @santhoshmedide5279
    @santhoshmedide5279 3 ปีที่แล้ว

    The last solution where time-O(N) and space-O(1) method is amazing. Came here after many leetcode solutions!

  • @krishnananddubey2870
    @krishnananddubey2870 3 ปีที่แล้ว +1

    Just explained it calmly loved that.🤗

  • @nareshh74
    @nareshh74 ปีที่แล้ว

    Thanks for the video. Can u logically explain how u chose 2 pointers approach?

  • @paragroy5359
    @paragroy5359 3 ปีที่แล้ว +1

    Nice explanation sir......you are doing a great job

  • @spaceship-rl5fp
    @spaceship-rl5fp 7 หลายเดือนก่อน

    Excellent Explanation

  • @elitesharma817
    @elitesharma817 3 ปีที่แล้ว

    Right at 21:35 I stopped and boom my code got accepted, thanks a lot bhai, I was trying to solve with 2 pointer approach as well but couldn't deal with the water-level stuff, which you made so easy to understand and grasp, and not just that also for improvising code in such an awesome way with 2N Auxiliary space. Again thanks a lot bhai

  • @monikavaid5083
    @monikavaid5083 2 ปีที่แล้ว +1

    Very good solution!,

  • @khushbukareliya8999
    @khushbukareliya8999 3 ปีที่แล้ว +1

    Best Explanation.

  • @shashirajitagi616
    @shashirajitagi616 2 ปีที่แล้ว

    Thanks for such an excellent explanation. I had one query, I think the code won't give the right sum for the array {4,3,1,5,0,5,0,3}. Can you help here?

  • @prathameshmore5262
    @prathameshmore5262 2 ปีที่แล้ว

    @TECH DOSE 1st approach is brute force approach right

  • @sujitha2339
    @sujitha2339 2 ปีที่แล้ว

    Clear explanation!! Thanks bro

  • @prakharagarwal6237
    @prakharagarwal6237 3 ปีที่แล้ว

    Nice Explanation! Thanks!

  • @basictechs6634
    @basictechs6634 2 ปีที่แล้ว

    Great explanation, thank you.

  • @ethanzhao5729
    @ethanzhao5729 3 ปีที่แล้ว +1

    Your explanation fits the process of how to solve a problem -- from observation of cases to generalization to optimization to final code. Pure memorization of the solution without following this process is not helpful to interviews

  • @CSe_IT_Guy
    @CSe_IT_Guy 2 ปีที่แล้ว +1

    Best explanation 👏

  • @CodeSuccessChronicle
    @CodeSuccessChronicle 3 ปีที่แล้ว +1

    Thank you so much for doing this on my request.... best bro...

  • @sandeepkharola6463
    @sandeepkharola6463 2 ปีที่แล้ว

    Great work
    Keep going 👍

  • @egor.okhterov
    @egor.okhterov 3 ปีที่แล้ว

    As we go from left to right `max_left` could only increase (or stay the same).
    As we go from right to left `max_right` could only increase (or stay the same).
    That is why when we move pointers L and R, `max_left` and `max_right` compete with each other. First one gets larger, then the other gets larger, then the other gets larger. And we swing from one side to the other side moving pointer L and R closer to each other.

  • @athisii_ekhe6167
    @athisii_ekhe6167 2 ปีที่แล้ว

    you made it easy. Thank you.

  • @huseyinbarin1653
    @huseyinbarin1653 2 ปีที่แล้ว

    very clear explanation!

  • @bloody9162
    @bloody9162 2 ปีที่แล้ว +2

    It's sad TH-cam has hidden dislikes on a video, stops good videos like this from showing up first. Thanks. 38k views and 1.2k likes? c'mon guys hit the like button.

  • @MousamiDeshmukh-g8k
    @MousamiDeshmukh-g8k 9 หลายเดือนก่อน

    I did not understand one thing @TechDose . Can you please tell me why are we choosing to go towards LEFT when left height is less and why to right-- when RIGHT height is less ?

  • @dayanandraut5660
    @dayanandraut5660 3 ปีที่แล้ว

    excellent explanation. awesome solution.

  • @vaishaligoyal7478
    @vaishaligoyal7478 3 ปีที่แล้ว +1

    Simply Amazing!!

  • @cs-ope
    @cs-ope ปีที่แล้ว

    Great explanation!

  • @arjunadityarastogi2118
    @arjunadityarastogi2118 3 ปีที่แล้ว

    Thank you , Just THANK YOU

  • @mpavankumar6695
    @mpavankumar6695 2 ปีที่แล้ว

    Great explanation

  • @atjhamit
    @atjhamit 3 ปีที่แล้ว

    Really good explanation! Thanks a lot.

  • @trueindian03
    @trueindian03 3 ปีที่แล้ว

    This was an excellent explanation.

  • @viveknandan4950
    @viveknandan4950 4 หลายเดือนก่อน

    Nice explanation.

  • @krupaharan9406
    @krupaharan9406 3 ปีที่แล้ว +1

    This saved my day :-) Thank you very much

  • @akshitjain2906
    @akshitjain2906 ปีที่แล้ว

    amazing explanation bro!

  • @charliecszatkowski5730
    @charliecszatkowski5730 2 ปีที่แล้ว

    what device and software allowes you to write of the screeen?
    do you use drawing pad?