3203. Find Minimum Diameter After Merging Two Trees | Diameter of a Tree | Graph

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

КОМЕНТАРІ • 20

  • @ARYANMITTAL
    @ARYANMITTAL  6 місяців тому +15

    I guess this one was easier than Problem 3, what do you guys think?
    Uber Interview on LLD-HLD Channel - ua-cam.com/video/VGYJIX5yl74/v-deo.html

    • @theexplorer9012
      @theexplorer9012 6 місяців тому +3

      same

    • @SDHANUSH-l9u
      @SDHANUSH-l9u 6 місяців тому +1

      Only problem here was to come up with an algo for Diameter 💀💀.
      Did not get this intuition of using one extreme to another extreme

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

      yess

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

      Have you gone crazy to go about privatising every video of your channel

  • @arnabchatterjee2094
    @arnabchatterjee2094 9 днів тому +1

    This video was great why? Cause you connected the dots between two concepts and apply it here clearing all the thought processes.. Thank you , your videos are truly helping me in getting better at leetcode problem solving and I can see my results while solving, thinking and approaching problem

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

    My approach was slightly different but i think the underlying intuition is the same. Basically find the centroid of both the graphs. From the centroid, do DFS to find the 2 largest heights (their sum would result in the diamater of the respective tree) and the combined diameter would be sum of the largest height of each tree + 1. We would then take minimum of these values.

  • @subhadrosamaddar6336
    @subhadrosamaddar6336 5 місяців тому

    nice explanation bro
    🥰

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

    My solution failed exactly on the "edge" case mentioned, it cleared my doubt why the answer is 7. Thanks!!!

  • @80-shreypatel96
    @80-shreypatel96 6 місяців тому

    please make video on leetcode 3202

  • @tirthpatel-t6u
    @tirthpatel-t6u 6 місяців тому

    Why we cannot use median method , it is giving me wrong answer on 453 test case , if i just join two medians of different trees , please reply @ARYANMITTAL

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

      you will need to track individual diameter of both the trees it could be the case that by joining two medians the path length is still smaller than any one of the two diameters

    • @tirthpatel-t6u
      @tirthpatel-t6u 6 місяців тому

      @@nutrinoflash6132 But how it can be , if am taking median , shoudln't the height is eqaul to half of diameter?

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

      Overkill

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

      @@tirthpatel-t6u ceil(x/2) + ceil(y/2) + 1

  • @monishtyagi2354
    @monishtyagi2354 5 місяців тому

    why soln giving TLE

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

    No Vedio on 1,2,3 ?

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

      Already live on channel sir🫡😮‍💨

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

    this solution gives tle , idk y