#23 Binary Tree Nodes | HackerRank SQL Solutions

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • Please follow us
    / dev.19.community
    Thanks for watching us ...
    Dev19🖤

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

  • @jaldaamol46
    @jaldaamol46 3 หลายเดือนก่อน +1

    Thank you, DEV19. I found it very difficult when I saw it first time. After watching this video I'm able to solve it in the time attempt.

  • @srividya09855
    @srividya09855 4 หลายเดือนก่อน +1

    In simple way explained TQ u

  • @caczback
    @caczback 4 หลายเดือนก่อน

    BRO, YOU ARE A GENIUS

  • @Md_Danish433
    @Md_Danish433 2 หลายเดือนก่อน

    select N,
    case
    when P is null then 'Root'
    WHEN N NOT IN (SELECT distinct P FROM BST) THEN 'Leaf'
    else 'Inner'
    end
    from BST order by N;
    When I try to use not in it's not working anyone know why? is it because null present in P?

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

    do I need to know the whole concept of binary tree to solve this question????

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

    thqqqqqq

  • @AmanBedi-sy4ht
    @AmanBedi-sy4ht ปีที่แล้ว

    I am getting an error using this, I know how to make it right (by removing Not) but why is it not showing the correct answer using this.?I did replace Leaf and Inner, Someone please help.
    select N,
    Case
    When P is NULL then 'Root'
    When N in(Select P from BST) then 'Leaf' else 'Inner'
    END
    from BST
    order by N

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

      hackerrank is now having this some kind of glitch when part of your query ends up into the output that is why it causes error . To fix this simply do AS something after END statement .
      this query will work -
      SELECT N,
      CASE
      WHEN P IS NULL THEN 'Root'
      WHEN N IN (SELECT P from BST) THEN 'Inner'
      ELSE 'Leaf'
      END as SomeAlias
      FROM BST
      ORDER BY N;

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

      @@sid_x_18 AS something after END isn't helping anymore :( any more ideas?

    • @sushantkumar8208
      @sushantkumar8208 2 หลายเดือนก่อน +1

      Try this:
      Select N,
      Case
      When P is null then 'Root'
      When N in (select P from BST) then 'Inner'
      else 'Leaf'
      End
      from BST
      order by N;

    • @sayalikawale3410
      @sayalikawale3410 2 หลายเดือนก่อน

      @@sushantkumar8208 It worked !

  • @Skautod
    @Skautod 11 วันที่ผ่านมา

    Sir pehle aap samajh lo