Ad
  • Custom User Avatar

    I'm sure that u are creating a new node with Node(pos), a node with default values like passable = True, to access to a node in the grid just pos.position or pos.passable.

  • Default User Avatar

    well i know im the dumb here, but this katas description is just way off.

    • no mention about the Node class
    • no description about its attributes
      the node.position returns no valuable information, at least for dumb me.
      the node.passable returns true for every position.. great invention..

    def find_shortest_path(grid, start_node, end_node):

    for line in grid:
        for pos in line:
            node = Node(pos)
            print(node.position, node.passable)
    

    S0110

    01000

    01010

    00010

    0001E

    (0,0) True
    (0,1) True
    (0,2) True
    (0,3) True
    (0,4) True
    (1,0) True
    (1,1) True
    (1,2) True
    (1,3) True
    (1,4) True
    (2,0) True
    (2,1) True
    (2,2) True
    (2,3) True
    (2,4) True
    (3,0) True
    (3,1) True
    (3,2) True
    (3,3) True
    (3,4) True
    (4,0) True
    (4,1) True
    (4,2) True
    (4,3) True
    (4,4) True

    how im supposed to know which node is truelly passable?

  • Default User Avatar

    I confirm. Even accepted solutions are too slow.

  • Custom User Avatar

    It seems most solutions pass in about 500 ms, a recursive solution passes in about 2 s.

  • Default User Avatar

    python is too slow for it or idk.. two legit solution is getting time outs. Even copy pasted one solution from github, same problem shows up. I think there are just too many tests to run under the given 12 sec. a bit disapointing.

  • Default User Avatar

    yeah mine too! but is there any benefit of these huge one liners?

  • Custom User Avatar
  • Default User Avatar

    False is 0, but 0 is not False, so first tell what should be done when False than with 0. Interesting that the bool will be 0 even if its converted to string.
    if i is False:
    action
    if i is 0:
    action

  • Default User Avatar

    this! now makes sense, thanks.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    number = random number, can be any, the system will provide them.