Corona Vaccine GeeksforGeeks Problem of the day | Binary Tree Cameras | Leetcode 968. | Binary Tree

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 50

  • @probabilitycodingisfunis1
    @probabilitycodingisfunis1  2 роки тому +3

    Time Complexity -> O(N)
    int novaccines = 0;
    int supplyVaccine(Node* root){
    // Your code goes here
    if(vaccine(root)=="want")
    novaccines++;
    return novaccines;
    }
    string vaccine(Node* root)
    {
    if(root==NULL)
    return "ok";
    string left =vaccine(root->left);
    string right =vaccine(root->right);
    if(left=="want" || right =="want")
    {
    novaccines++;
    return "provide";
    }
    else if(left=="provide" || right =="provide")
    return "ok";
    return "want";
    }

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

    Crystal clear explanation👌

  • @ShivangiChandra-o3v
    @ShivangiChandra-o3v Рік тому

    great explanation!

  • @visase2036
    @visase2036 2 роки тому

    Amazing explanation! Great work.

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

    I like the way you do coding

  • @ojasviverma7055
    @ojasviverma7055 2 роки тому

    Super Smart Coder 🌟 :)

  • @HeyRajSingh
    @HeyRajSingh 2 роки тому +1

    "Please add POP filter with mic" -- suggestions
    Because the pop pop air sound is disturbing...

  • @Man_of_Culture.
    @Man_of_Culture. 2 роки тому

    I think there should be one more if condition i.e when from both left and right child gives "ok" then node should itself provide vaccine . Please correct me.

  • @aryanpatidar5392
    @aryanpatidar5392 2 роки тому

    quite a fresh and unique take on question

  • @lovebarot1019
    @lovebarot1019 2 роки тому

    nicely explained by you keep it up

  • @S7covers
    @S7covers 2 роки тому

    Why the same code is not executing in Java? And serious issues?

  • @sigma7253
    @sigma7253 2 роки тому +1

    Mind blowing dude . Hats off. Breaked all the limits

  • @Nikita-hv5jm
    @Nikita-hv5jm 2 роки тому

    thanks a lot for such an awesome explanation

  • @shadowaj9278
    @shadowaj9278 2 роки тому

    Ahhh amazing and very gracefully explained. After this go and try out leetcode binary tree camera 📷

  • @pateladarsh1463
    @pateladarsh1463 2 роки тому +3

    Amazing , Thank you for making videos ... ur videos are very helpful

  • @mr_blaze62
    @mr_blaze62 2 роки тому

    Thank you !very nicely explained.

  • @chiraggoel4131
    @chiraggoel4131 2 роки тому

    Watching ur first video and u just nailed it...way u return string is 👌

  • @pranshukashyap6848
    @pranshukashyap6848 2 роки тому

    In the Question, it's given that the input tree is a binary tree but in some of your examples you had taken a tree with node having more than 2 children, but the overall explanation and solution was really awesome !! Nice Approach ..

    • @probabilitycodingisfunis1
      @probabilitycodingisfunis1  2 роки тому +1

      Thanks, I have not taken tree with node more than 2 children, all are binary tree examples , can you point out where there is confusion?

    • @pranshukashyap6848
      @pranshukashyap6848 2 роки тому

      @@probabilitycodingisfunis1 at 3:11 , 17:50 although not a big issue, you just took those examples to explain your intuition. ✌️✌️

    • @probabilitycodingisfunis1
      @probabilitycodingisfunis1  2 роки тому +2

      Pranshu both are still binary trees , maybe it created confusion because I wrote it that way,
      For example at 3:11 the tree is:
      5
      1
      3 2
      4
      And on 17 :50 the tree is
      6
      3
      2 4
      1 5

  • @durgeshsahu.7
    @durgeshsahu.7 2 роки тому

    OP didi 🔥🔥🔥🔥🔥🔥

  • @anandkhond5474
    @anandkhond5474 2 роки тому

    Good explanation.👍

  • @shikharverma674
    @shikharverma674 2 роки тому

    Amazing explanation

  • @gautamjangir8927
    @gautamjangir8927 2 роки тому

    Explanation is Awesome but please do discuss about the complexity( Space and Time )....Thanks.

  • @MilindGupta
    @MilindGupta 2 роки тому

    Watching this again forgot how did i approached it :\

  • @sunilbhenspaliya9931
    @sunilbhenspaliya9931 2 роки тому

    good explanation😊

  • @shwetanksingh5438
    @shwetanksingh5438 2 роки тому

    This is more intuitive than using a map.

  • @vijaysairavishankarguptha5034
    @vijaysairavishankarguptha5034 2 роки тому

    Awesome explanation 😄

  • @dhananjoydey1337
    @dhananjoydey1337 2 роки тому

    can you upload solution of the leetcode problem "1675. Minimize Deviation in Array"?

  • @greatred2558
    @greatred2558 2 роки тому

    Hey, please make a video on Maximum Width of Binary Tree, lc662

  • @amolmishra8621
    @amolmishra8621 2 роки тому

    Awesome explanation!

  • @virusnetic
    @virusnetic 2 роки тому

    Great Explanation, Keep up the good work and contribution to this community.

  • @rohan7071
    @rohan7071 2 роки тому

    Almost cried in the last case 😭

  • @dhananjoydey1337
    @dhananjoydey1337 2 роки тому

    Niceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee