2192. All Ancestors of a Node in a Directed Acyclic Graph - Day 29/30 Leetcode June Challenge

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ต.ค. 2024

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

  • @Algorithmist
    @Algorithmist  4 หลายเดือนก่อน +6

    Were you able to get all the ancestors?

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

    I was a bit busy today, hometown visit.
    Did by recursion though

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

    Nice explanation. Just beginning graphs and made that mistake [[] * n] yesterday LoL. Btw, sorted() already returns a list in the second last line.

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

      there are a lot of things in python that returns an iterable - I don't have them memorized, so it's just easily to do this.

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

    going bottom up (starting from no children) and using a queue gave me a tle.

  • @amanomkar6165
    @amanomkar6165 3 หลายเดือนก่อน

    leetcode daily