Ad
  • Custom User Avatar
  • Custom User Avatar

    can you explain how you overcame the timed out issue , i tried all methods and still encounter "tied out"

  • Custom User Avatar

    The instruction is very poorly phrased and difficult to understand

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    the only meaninguful information a Node carries in this kata is its unique address in memory, so the === operator is what you need

  • Custom User Avatar

    added sample tests to Ruby

  • Custom User Avatar

    do not use global/static variables, they keep their values between tests of the same batch.

  • Custom User Avatar
  • Custom User Avatar

    Thanks for explaining. I had come to this conclusion and was interested if this was a common practice, or a gap in my knowledge. For me, it would be preferable to have this nuance mentioned in the description. As I say - the assumption, from me at least, is that returning to the same node should be the same node (i.e. is return True) and not just a comparably equal node. Anyway, it was an interesting process for me to work through and I learnt from it so I will take the positives!

  • Custom User Avatar

    It doesn't work because the python implementation of the node class creates a new instance of node every time you ask for the next node (but with the correct ID). Needless to say, this is not typically how you would implement a linked list. I think this was done so people couldn't mutate the nodes as they traversed the LL and check for their mutations when they came across the node again. It seems the author wanted users to solve in a very specific way and intentionally disabled tools you would normally have in order to enforce that solution (for example, the node instances are not hashable either).

    But long story short, for dumb reasons, the reason is doesn't work is because you aren't comparing the same instances... it's a new instance every time you call node.next

  • Custom User Avatar

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

  • Custom User Avatar

    Do you mean "work like that"? And if so, work like how? You're asking people to read your mind.

    If the id's are not what you expect for whatever reason, it's probably because the only two operations you're allowed to use for the kata are == and .next, other operations are intentionally made to not relate to the loop, looking at their id's isn't a meaningful operation for this kata.

    More specifically, you are given a new node every time you ask for the next one, even in the case that it is an already visited one, and the only way you can tell is by asking the two nodes if they are equal by using ==. Getting the same id twice is just python reusing id's, it does not indicate that it is the same node, they're two separate objects - python only promises that id's are unique for two objects that exist at the same time which isn't what you've got there.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Loading more items...