Lowest Common ancestor of binary tree

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.ย. 2024
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. For a better experience and more exercises, VISIT: www.pepcoding....
    Have a look at our result: www.pepcoding....
    Follow us on our TH-cam page: / pepcoding
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education
    Follow us on Pinterest: / _created
    Follow us on Twitter: home
    .
    .
    .
    Happy Programming !!! Pep it up 😍🤩
    .
    .
    .
    #pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive #competitiveprogramming #softwareengineer #engineering #engineer

ความคิดเห็น • 17

  • @pallavibansode6588
    @pallavibansode6588 2 ปีที่แล้ว +4

    Great job👍....tree was toughest data structure till the date ....but after watching this series every question is looking so easy and understandable....thank you so much for such great amazing series 😀

  • @ytgamingraju7304
    @ytgamingraju7304 3 ปีที่แล้ว +5

    Sir g bahut hi achha explain kiya hai...this problem looked like nothing after watching your explanation.

  • @sushilkumarrai8956
    @sushilkumarrai8956 3 ปีที่แล้ว +2

    Sir pepcoding ki sari videos bahut achi hoti hai. Keep going

  • @rishabhgoyal8110
    @rishabhgoyal8110 2 ปีที่แล้ว +1

    What a series! Thanks!

  • @shang_chi4651
    @shang_chi4651 3 ปีที่แล้ว +1

    Kya mast samjhaya sir😁🙏thanks a ton

  • @sidharthsinghmarwah
    @sidharthsinghmarwah 3 ปีที่แล้ว +1

    really good video

  • @AshokKumar-ot3dz
    @AshokKumar-ot3dz 3 ปีที่แล้ว +1

    Great

  • @AshokKumar-ot3dz
    @AshokKumar-ot3dz 3 ปีที่แล้ว +1

    Sir, LCA of generic tree ki efficient approaches kara do... Sumit sir ne Level 1 mein node to root path wala method kara rakha hai.

  • @nirmitshah5325
    @nirmitshah5325 2 ปีที่แล้ว +1

    I think this program will also work for 1644. Lowest Common Ancestor of a Binary Tree II right?

  • @anuragnegi6423
    @anuragnegi6423 3 ปีที่แล้ว +1

    Sir please make a video on "binary lifting"

  • @dheerajchhatani7610
    @dheerajchhatani7610 3 ปีที่แล้ว +1

    gr8

  • @azeemali6865
    @azeemali6865 ปีที่แล้ว

    ok x 100

  • @walkWithDinkar
    @walkWithDinkar 2 ปีที่แล้ว +1

    ok

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      For better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @divyanshuchaudhari3257
    @divyanshuchaudhari3257 3 ปีที่แล้ว +1

    This code is giving incorrect answers.

    • @chiragpagaria4353
      @chiragpagaria4353 2 ปีที่แล้ว

      yes why it is

    • @derilraju2106
      @derilraju2106 2 ปีที่แล้ว

      class Solution:
      def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
      if not root:
      return None
      if root.val == p.val or root.val==q.val:
      return root
      left = self.lowestCommonAncestor(root.left,p,q)
      right = self.lowestCommonAncestor(root.right,p,q)
      if not left:
      return right
      if not right:
      return left
      return root