Container With Most Water - (Meta, Google, Amazon) : Explanation ➕ Live Coding 🧑🏻‍💻👩🏻‍💻

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 34

  • @Kunalbindra
    @Kunalbindra 7 місяців тому +22

    He never asked us for like , share and subscribe 🙇‍♂. A True GEM...

  • @Malayalam_learner
    @Malayalam_learner 4 місяці тому +3

    Question is so intimidating i have seen this question and left it right away

  • @surajsidar3280
    @surajsidar3280 7 місяців тому +2

    I am watching the solution after the interview.
    I was asked how and why we were moving two pointers.
    I got the answer.
    We have to find a minimum of two heights of left and right pointer
    Since we are decreasing the width, to maximize the water contained we will move the pointer pointing to a smaller height.

  • @sonukumarram1880
    @sonukumarram1880 10 місяців тому +4

    Ur explanations , the way of teaching .... big fan sir really feeling blessed

  • @sanyaadoda
    @sanyaadoda Місяць тому +1

    Awesome explaination. Thank you!

  • @tutuimam3381
    @tutuimam3381 Рік тому +3

    Amazing explanation

  • @MohammedHasmi577
    @MohammedHasmi577 22 дні тому

    Sir kya smjaya 🔥❤

  • @isha25tripathi12
    @isha25tripathi12 8 місяців тому +5

    Thank you so much. When I first read the question I was afraid that its too difficult and when you read the question I was able to do it on my own without listening to the whole explanation.

  • @Satya-g5t
    @Satya-g5t 2 місяці тому

    nice solution and well explained.

  • @prashupandey1304
    @prashupandey1304 Рік тому +2

    You are the best bro !!!🙏🙏

  • @varunupadhyay2488
    @varunupadhyay2488 Місяць тому +1

    great explanation

  • @heyOrca2711
    @heyOrca2711 Місяць тому +2

    Thank You Mik...

  • @saketjaiswalSJ
    @saketjaiswalSJ 8 місяців тому +2

    god level explanation brother

  • @abcd76820
    @abcd76820 10 місяців тому +1

    cant we apply trapping rain water problem logic with modification ?

  • @ikitayadav3272
    @ikitayadav3272 6 місяців тому +1

    omg why i didn't find this channel earlier

  • @cosmicthor7330
    @cosmicthor7330 4 місяці тому

    bhaeeya if index 2 pey 6 ki jagah koi bara number hota jaisey 45 to area hamara chut jata na ,kiwki dono height same hai start and end ka if uskey neigher ka height bara ho to compare krna pareyga na kis side move krey i ko ya j ko hope mai smjha paya apna question

  • @iamnoob7593
    @iamnoob7593 Місяць тому

    thanks

  • @socialmedia3167
    @socialmedia3167 Місяць тому

    what is 8*8 =64 is it max?

  • @DeepakSingh-fd2ix
    @DeepakSingh-fd2ix Рік тому +1

    sir how this question is different from maximum area histogram

    • @harchitgulati3065
      @harchitgulati3065 Рік тому

      same doubt

    • @parul15137
      @parul15137 9 місяців тому

      in that we were seeing consecutive heightss to form a rectangle by using the concept of nsl and nsr of stack by taking the current idx height but there isnt any consecutiveness , but here we are storing the water even if the heights in b/w are smaller or bigger we can take them cos water will be stored b/w so we dont care what heights are coming in b/w but in the histogram one if the fluctuation of heights occured our rectangle will be disformed which we dont want

  • @Codenow10222
    @Codenow10222 8 місяців тому

    when the height is same why are we allowed to shift any of them i and j . because in the above question when both i and j if we move i then the maxArea is 24 but if we move from j then it will be 16

    • @Lakshya-f4l
      @Lakshya-f4l 6 місяців тому

      same question

    • @varshneyshuchi
      @varshneyshuchi 6 місяців тому

      whatever you choose .. will it effect maximum?

  • @harshsingh7713
    @harshsingh7713 11 місяців тому +1

    Bhai aapke subscriber bhut tezz badd rhe
    Badhai ho

  • @nitkarshchourasia2406
    @nitkarshchourasia2406 3 місяці тому

    class Solution {
    public:
    int maxArea(vector& height) {
    // find length
    // find height
    int n = height.size();
    int left = 0;
    int right = n -1;
    int maximum = INT_MIN;
    while (left < right) {
    int l = right - left;
    int h = std::min(height[left], height[right]);
    (height[right] > height[left]) ? left++ : right--;
    int k = l * h;
    if (k > maximum) {
    maximum = k;
    cout

  • @AnkitJain-w3l
    @AnkitJain-w3l 10 місяців тому

    Day 3

  • @rode_atharva
    @rode_atharva 7 місяців тому +1

    class Solution {
    public:
    int maxArea(vector& height) {
    int maxwater = 0;
    int left = 0;
    int right = height.size()-1;

    while(left < right){
    maxwater = max(maxwater, min(height[left], height[right])*(right-left));
    if(height[left] < height[right]){
    left++;
    }
    else{
    right--;
    }
    }
    return maxwater;
    }
    };

  • @aaravanand2325
    @aaravanand2325 11 днів тому +1

    Thankyou