3249 Count the Number of Good Nodes || How to 🤔 in Interview || Build Graph + DFS || Math

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

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

  • @suyashjain3223
    @suyashjain3223 5 หลายเดือนก่อน +1

    Nice Explanation!! Thanks!!

  • @Trownekos-gc4hu
    @Trownekos-gc4hu 5 หลายเดือนก่อน +2

    good solution, thank you

  • @sourabhvishwakarma6274
    @sourabhvishwakarma6274 5 หลายเดือนก่อน +2

    very helpful 🔥

  • @Vishwesh_8451
    @Vishwesh_8451 5 หลายเดือนก่อน

    Code didn't understodd properly
    WHy ans is used and how it ensures that each subtree is same size

  • @shatulbansal4756
    @shatulbansal4756 5 หลายเดือนก่อน

    1 more query bro, we could have also solved this question, by converting it into a N-ary tree and then applying recurison on that N-ary tree, right??

  • @shatulbansal4756
    @shatulbansal4756 5 หลายเดือนก่อน

    Bro, if we didn't use the parent node in this DFS. then only simple DFS would have not worked in this question, right?

    • @Code_With_Confidence
      @Code_With_Confidence  5 หลายเดือนก่อน

      No shatul, either parent node or visited array need to be used

    • @shatulbansal4756
      @shatulbansal4756 5 หลายเดือนก่อน +1

      @@Code_With_Confidence got it, thanks bro.
      Nice solution btw bro :)