Ad
  • Custom User Avatar

    Focused on Performance. ( Reducing duplicate operation )
    First step, create a tree which visits all cells.

    1. start with (0,0) and expand forming initial tree.
    2. find an unvisited cell (orphan) that's neighbor to tree.
      connect the cell to the tree and expand from the cell.
    3. repeat 2) till all cells are visited.
      and expand since this c
      Second step, make more doors open. [Skipped]
  • Custom User Avatar

    In some cases, the exploring will stop even when not all the cells are visited.
    And why not call explore(0,0) in the beginning?

  • Custom User Avatar

    I attempted with my solution.
    The result is

    Time: 344ms Passed: 24 Failed: 0 Errors: 1
    
    Test Results:
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
    ✔ Test Passed
     Same path found in different mazes
    

    What does this "Same path found in different mazes" mean?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Most of all, it doesn't return 0. 0 can be answer too. Isn't it?