SHORTEST PATH IN A HIDDEN GRID | LEETCODE 1778 | PYTHON DFS + BFS SOLUTION

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

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

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

    Hey, this is awesome solution, thanks for posting.
    The MOST crucial part of your solution is to not remove visited coordinates in DFS and reuse the visited set in BFS. Wanted to explain your viewers - its importance in your approach.
    This is because the visited set kinda guides the BFS algorithm - what cells can be visited and what are not. Like, it'll help you to not add a location with obstacle and etc.
    If a location is in the visited set after DFS - it is a good location.
    And that set is why this approach works.
    cheers.

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

    Thanks for doing this problem. Can you please do 'Remove Sub-Folders from the Filesystem (LC 1233)'?

  • @ziqinwu2337
    @ziqinwu2337 26 วันที่ผ่านมา

    thank you!

  • @sh-oj8ei
    @sh-oj8ei 8 วันที่ผ่านมา

    hi you didnt explain why we need backtracking is it to get back to the starting position?

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

    Is there a reason to pick this problem? - This requires premium leetcode subscription.

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

    Awesome solution. Would be great if you can help understand how are we assuming 0,0 as source