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

Поделиться
HTML-код
  • Опубликовано: 26 дек 2024

Комментарии • 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 - ruclips.net/video/VGYJIX5yl74/видео.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 3 дня назад +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 5 месяцев назад

    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!!!

  • @monishtyagi2354
    @monishtyagi2354 5 месяцев назад

    why soln giving TLE

  • @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 5 месяцев назад

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

  • @80-shreypatel96
    @80-shreypatel96 6 месяцев назад

    please make video on leetcode 3202

  • @shreyash184
    @shreyash184 6 месяцев назад

    No Vedio on 1,2,3 ?

    • @ARYANMITTAL
      @ARYANMITTAL  6 месяцев назад

      Already live on channel sir🫡😮‍💨

  • @rishabhgoel8936
    @rishabhgoel8936 5 месяцев назад

    this solution gives tle , idk y