Find Eventual Safe States - Leetcode 802 - Python

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

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

  • @tanmaypiyushkaushik
    @tanmaypiyushkaushik 17 часов назад +28

    Solved it on my own, but now it’s become a habit to watch your videos daily (after solving/trying problems on leetcode).

  • @NeetCodeIO
    @NeetCodeIO  18 часов назад +2

    Code solutions in other languages: neetcode.io/solutions/find-eventual-safe-states

  • @salvestised3718
    @salvestised3718 17 часов назад +8

    1:26. Node 4 is not a terminal node as mentioned in the video

  • @skanderbegvictor6487
    @skanderbegvictor6487 19 часов назад +1

    Solved it on my own for the first time

  • @flexogeek
    @flexogeek 12 часов назад

    1:28 I think 4 has an outgoing edge therefore is not a terminal node. great solution anyway

  • @amirasajidmohdshaikh9640
    @amirasajidmohdshaikh9640 8 часов назад

    lol I did solve it myself and ended up creating an adj list again sad...made up three states... Your videos are always the most efficient solutions to exist!

  • @MP-ny3ep
    @MP-ny3ep 16 часов назад +1

    Thank you for the daily. If I'm not wrong I think you've done this problem already once

    • @jigar2238
      @jigar2238 15 часов назад

      yeah. this is old video of his. likes are 1.5k on the problem. now its 6k.

    • @jigar2238
      @jigar2238 15 часов назад

      by the way are you from US ?

  • @JamesBond-mq7pd
    @JamesBond-mq7pd 16 часов назад +1

    I thought DFS is too long but forgot about cache

  • @staywithmeforever
    @staywithmeforever 9 часов назад

    I thought the exact solution but I am unable to put in code

  • @howardlam6181
    @howardlam6181 14 часов назад +1

    there is no need for hashmap. A simple array of length n is enough. graph contains arrays of children of each node and the children array contains the index.

  • @Hoppitot
    @Hoppitot Час назад

    God I love the feeling of thinking you can solve it in 15 minutes only to get TLE:d at the 2 hour mark...

  • @niravbharadiya2901
    @niravbharadiya2901 3 часа назад

    this way, the cycle detection is not that clear.

  • @yhbarve
    @yhbarve 17 часов назад

    I was able to do this on my own, but it wasn't the most efficient solution.

  • @HeroicVampire
    @HeroicVampire 7 часов назад

    I got TLE for this solution in c++

  • @LeonLeonLeonardo
    @LeonLeonLeonardo 20 часов назад

    First comment! 🤗