236. Lowest Common Ancestor of a Binary Tree | EPIC Tree Series | leetcode | DSA

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

Комментарии • 10

  • @prashantchaudhary8147
    @prashantchaudhary8147 15 дней назад

    Your way of explaining things is very smooth. Keep going.

  • @ShivamMaurya-ee4zp
    @ShivamMaurya-ee4zp 3 месяца назад

    Best explanation on youtube ❤

  • @surajgaur4770
    @surajgaur4770 3 месяца назад

    Very deep understanding and cleared recursive approach.

  • @sandeepnaikat5598
    @sandeepnaikat5598 Месяц назад

    great work thanks , most of the topics learning from u only
    😊😊😊

  • @ABsStudio-s1u
    @ABsStudio-s1u 3 месяца назад

    Keep Going

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh 3 месяца назад

    Thanks 😊

  • @mr.nishantawasthi4402
    @mr.nishantawasthi4402 7 месяцев назад

    Nice explain sir ❤

  • @susmoy4385
    @susmoy4385 7 месяцев назад

    Vaiya notes update kardo .. bohot Sara lecture ka notes Nehi hain .. notes or codes ko agar update kar dete to bohot accha hota

  • @subratamandal2924
    @subratamandal2924 3 месяца назад

    Intuition ekdam bakwas. Sirf process bol diya aur usko samjhaya kyun aur kaha se wo process aya ku6 nhi bola. Last mein code ke baqt main bhi jyada nhi samjhaya..ho sakta hai mujhe samajh nhi aata
    Per explanation a66a nhi laga. 4 bar dekha phir bhi nhi. Aap improve kar sakte ho
    Thanks

    • @i_do_what_i_like
      @i_do_what_i_like 3 месяца назад

      Maybe this will help you. I assume you understand the definition of LCA. To find it Shashwat said LCA would be the first common node we will get when we move upwards from the bottom (bottom up). Here we traverse the tree in pre-order (a type of DFS). In pre-order we process the current node, then go towards left and then go towards right. When our pointer is on any of the target node we return the address to its parent. If we reach the end of tree without finding one of target nodes, we return null. Now when recursion will unfold itself, the parent which will have two non null values will be our answer because it will the first common node to the two target nodes.