Container With Most Water | leetcode 11 | Hindi

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ส.ค. 2024
  • liked this video? Click here / @codebix1096
    join our Facebook group :- / 258049468776636
    problem :-leetcode.com/p...
    code :-

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

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

    Let me simplify this for those who still find it confusing . We know that water container is a rectangle so area will be simply lxb = area so either we need to increase the length or the breadth to maximise the area . Placing the pointer at two ends creates maximises the length now the interesting part if you move any of the two pointer then you are reducing the length so to balance it you must increase the breadth(height) . There are two pointer pointing to two different height now obviously we need to move that pointer which has less height among the two and we move the pointer unless it finds a height that is greater than its previous value and then calculates the area and store . This proces is repeated to calculate the max area . Hope it helps 🙂

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

      I read your comment before watching videos . understood the solution by seeing your comment. Asowme explanation bro

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

      Thank you!

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

      after reading your comment i didnt even need to watch the video

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

    Sab koi sirf two pointer two pointer chilla rahe hai... aapne hi clear kar diya ke kyo hum un cases ko ignore karenge. Mazza a gaya. Ab confidence hai aur koi ratne ki zaroorat nai.

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

    I have seen tons of videos, all I could find is code and complexity discussion, however I could not visualize how they came up with the code and why to reduce particular pointer. This is the best video I have seen so far which made me visualize what is actually happening in detail. Great job. Superb explanation. Please make more videos on Hard/Medium Problems of LC.

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

      Thank you.
      means a lot
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

      Agreed! This is the best video on this particular problem. Clearly explained why we could ignore the other possibilities when we move the pointer. Great Work!

  • @R_Manna
    @R_Manna 4 หลายเดือนก่อน +1

    00:00
    The key point is to maximize water volume in containers with different heights by calculating differences and exploring various possibilities for optimal solutions.
    05:12
    Exploring various scenarios to maximize area calculation by considering different heights and possibilities.
    10:24
    Ignoring certain cases in problem-solving can save time and lead to better results. Maximizing area by comparing height and length is crucial for efficiency in solving problems.

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

    Itne badhiya se samjha diya bhai apne to, Thank you brother :)

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

    Stuck on the explanation for half an hour. Glad I found this video!

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

    idhar udhar baat ghumaaye bina sateek samghaya hai. Thanks a lot sir!!! Kyu chote wale ko aage badha rahe main yhi smaghna tha aur wo aapne acche se samghaya.

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

    I comment rarely on Yoututbe..Trust me You did the Best Explaination..
    I followed the same approach of using two for looops and when u said about that in video ,i was totally suprised...
    and your way of explaination for O(n) is awesome...

  • @AbhishekGupta-cg2vj
    @AbhishekGupta-cg2vj ปีที่แล้ว +2

    if we are doing len = r-1 then one test case is not passing ,instead we should use (r-l)
    more optimised code will be --
    class Solution {
    public:
    int maxArea(vector& height) {

    int l = 0;
    int r = height.size()-1;
    int maxi = 0;
    if( height.size() ==2 )
    {
    maxi = min(height[l],height[r])*r;
    }
    while(l

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

    very clear explanation.
    code in python :-
    class Solution:
    def maxArea(self, height: List[int]) -> int:
    l = 0
    r = len(height) - 1
    max_area = 0
    while(l max_area:
    max_area = area
    # print(max_area)
    if height[l] < height[r] :
    # we are doing this as right is greater than left so we will move to left to right to get max value area
    l +=1
    else:
    r -= 1
    return max_area

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

    Thanks...I really enjoyed your explanation..you are spending more time to explain logic rather than code ..That is awesome man...

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

    Awesome explanation and visualisation, after watching your explanation, I wrote the code by myself, crystal clear video. Maza aa gaya.

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

    The best channel to understand this problem, you have portrayed a medium level problem to a easy problem.

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

    i was struggling for the entire day trying to figure out why we use two pointers, finally peace. thank you so much!!

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

      You seriously struggled the whole day for this question? I thought I was alone ! Heheh high 5 buddy!!!

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

      @@ayeshaadhikari6123 yeah. just need to keep practicing and you'll finally be able to solve any type of Q

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

    One of the best tutorials ever I had seen on this platform

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

    great explanation, forward to 05:50 for saving time

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

    Best explanation till now for this question. Thank you so much sir

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

    Easiest explanation of this problem that anyone can ever find.

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

    Bhai approach smjhi or code likha , 1st attempt m hi hogya ..... Thanks for such a beautiful explanation 👏

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

    Best leetcode solution of this problem on youTube.

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

      Thank you.
      Appreciate it.
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

    Thank you for explaining the most confusing part. No doubt best explanation for this particular question. God Bless you!!

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

    see basically left will be moved till it finds a line greater than the right and vice versa right will be moved till it finds a line greater than left as a result min of left right is taken and mul with the length.(tip-area=l*b(or h)) therefore as L decrease h should increase

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

    your way of explanation is easy and clear thanks a lot for this amazing solution video

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

    sir pls make series of leetcode questions on dp sir.Thanks for beautiful solution

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

      Already uploaded.
      Thank you.
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

    Bhiya, bohot best explanation hai, phod dia, thanks...
    Mai 1st time is channel par aai hu or 💯 satisfaction mila. superb explanation...
    Dimag mai ghusa dia concept...
    Aap ko kabhi bolne ki jaroorat nhi padegi - "channel subscribe karo", aapke content kii quality awesome hai

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

    Nice explaination bhai, mein samajh hi nahi paa raha tha sirf solution padh ke. Superb.

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

    thanks. I was thinking of why moving the pointer for smaller height is equivalent to checking all answers and you cleared my remaining doubt.
    When moving from outside to inside, the span reduces anyway, we hope to find a taller height wall by considering a different wall from the smaller of the two at a time.

  • @user-hy2qe4ov7q
    @user-hy2qe4ov7q 3 หลายเดือนก่อน

    we can make it more faster. if we keep doing left++ or right-- untill we find the greater height than the min height.

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

    bohot jyada clear and crisp explanation tha bhay!!!

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

    Best explaination ever ! you got one more subscriber :)

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

    great explaination, so easy to understand, thank you so much

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

    Maza agaya.. Thank you so much . Last time ratta mara tha.. chalo finally feeling better ki understood the logic.. Thank you for the amazing content.. from now i better look leetcode questions from your channel only..Thank you..

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

    sir to mera liye god ha sach me..... thanks a lot

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

    Clear and crisp explanation

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

    lots of love brother. subscribed!!☺

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

    You should make more videos sir 🥺🥺 abhi tak kisi ne itne ache se ni smjhaya hai dsa .. pleaaaaaaaase make more videosssss

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

    the best explaination of a problem I've ever got on youtube, you're best in expressing your thoughts. great job!

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

    This video is amazing! The way you explained the solution , sir, it was so beginner friendly, easy to understand, easy to visualise and all the reasons for selecting a particular move, perfectly explained. I have seen so many coding solution videos, but THIS IS THE BEST TILL NOW! BIG THANKS!

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

    absolutely loved the explaination.....

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

    not all superheroes wear a cape!
    explanation couldn't get better, thanks

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

    Best ever explanation in youtube

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

    crisp and sweet sir.....

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

    Bhaiji..aap videos bhut h dil se banate ho..I always learn a lot from your videos.
    Thank you so much..:)

  • @AdityaSharma-er3gs
    @AdityaSharma-er3gs ปีที่แล้ว +1

    meine vaise hi kiya tha jaise aapne pehle bataya(two pointers), time limit exceed ho gayi🥲

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

    Aapne bhot hi well samjhaya h..Thanks Sir...Hare Krishna..

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

    Beautifully explained !! This was really crystal clear explanation !!!

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

    Great explanation.Aap great hai.

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

    Amazing explanation! To the point and explains the intuition behind the problem very accurately! LOVED IT!

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

    Nice brother for explaining it so easily

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

    Simple and sorted explaination

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

    thanks sie , you explained it with very op method
    but don't know why the code giving me TLE

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

    Bhai yaa to apka mic god level h ya to aawaz me dum h..you sound like a RJ

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

    wow, 10:02 👌👌👌👌

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

      Thank you.
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

    Your explanation is helpful but also so funny I'm cracking up hahahahaha

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

    Great Sir , I hit the jackpot in the first go.......

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

    Thank you so much sir

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

    Everytime, we are moving our pointer i ahead if height of line at ith index is smaller or j pointer if height of line at jth index is smaller. This means whichever line is smaller, we won’t consider it again, because, this line could be the answer only if the other line is larger than it and at maximum width and to be noticed that this is the time when other line is larger as well as max distance apart. So, not considering it makes sense.

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

    nice explanation sir....

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

      Keep watching.
      Thank you.
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

    Sir you are best teacher

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

    literally i just watched only 2:25 min and i solved that without seeing solution 😍.. coz of directly clear explanation.. waht this question want to say 💜🖤...

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

    Great explanation

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

    Wow what an amazing video! I was struggling a lot with this one ,thanks anyway.

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

    literally very neat and clean explanation i was confused in this question after watching this concept ....... all clear

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

    thankss sirr! it cannot be this simple

  • @rahulkumar-rx5ue
    @rahulkumar-rx5ue 3 ปีที่แล้ว +1

    Best 2 pointer explanation
    Thank you sir

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

      Most welcome
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

    superbbbbb brother loved the explanation ..

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

    bhai great 👍

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

    Thank you brother for amazing approach , this is the best video on youtube for this question

  • @pg-hq4dm
    @pg-hq4dm 16 วันที่ผ่านมา

    thanks brother.....

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

    This is one of the best explanation I have ever found.. Excellent job! Automatically became a subscriber and looking forward for more insightful videos!!!

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

    Thanks a lot sir, it helps a lot. Please make more videos like this🙏🙏

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

    Thanks it was great

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

    Wow very helpful video sir

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

    ty bhai god bless u

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

    bhot badiya explanation hai sir

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

    The best explanation for this problem...Thanks:)

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

      Thank you.
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

    you nailed it bro

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

    the best explanation. Next level. Thank u so much !!!

  • @AnjaliSingh-ee3xe
    @AnjaliSingh-ee3xe 3 หลายเดือนก่อน

    Thanks a lot 🙏

  • @AtulKumar-hg8pj
    @AtulKumar-hg8pj 2 ปีที่แล้ว

    Thank you sir for explanation ............

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

    Impressive explanation!!!!!!!!!!!!

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

    Great Explanation sir.....!!! Keep making more videos like this and helping us in understanding concepts very well.😊. Thanks again, sir.

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

    This is the best video explanation for this problem on YT I can bet. Thanks a lot. @CodeBix please upload more videos on medium problems.

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

    Man!! best explaination out there. Keep up the good work!!

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

      Appreciate it.
      Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true

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

    I was asked this question on Goldman Sachs interview and couldn't come up with this solution.

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

    you earned a new subscriber!!

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

    crazy explanation!! you earned a sub

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

    Thank you bhaiya nice explaination

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

    very well explaination brother thank you so much

  • @user-wm4hp5wd9f
    @user-wm4hp5wd9f ปีที่แล้ว

    Nicely Explained

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

    👩‍🎓too good explanation.

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

    Very nice explanation.

  • @34-devendrasinghit18
    @34-devendrasinghit18 ปีที่แล้ว +1

    nice explaination

  • @RajeshVermaVilgax
    @RajeshVermaVilgax 7 วันที่ผ่านมา

    Nice explanation 😮 😀

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

    Great explanation bro !!

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

    thank you so much

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

    you explain every question so well🙌

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

    thank you, sir nice explanation

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

    you literally rocked it too good explaination loved it :)

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

    Best explanation. Keep making such videos. You got sub + 1 :)