Explanation to some BFS doesn't work


  • 0
    Y

    @LionZhou @wangchongye-126-com @Andrinux

    When mark visited, do it immediately after the cell is put into the queue.

    If you do it after it is pooled from the queue, it got TLE.

    More detailed explanations are in my gitbook.

    I am writing in gitbook to summarize my thoughts. Welcome to contact me to discuss. Thanks.


  • 0
    B

    It works! Thanks, man!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.