Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
How so?
can you explain how you overcame the timed out issue , i tried all methods and still encounter "tied out"
The instruction is very poorly phrased and difficult to understand
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
the only meaninguful information a
Nodecarries in this kata is its unique address in memory, so the===operator is what you needadded sample tests to Ruby
do not use global/static variables, they keep their values between tests of the same batch.
fixed there
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.
isreturnTrue) 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!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
isdoesn't work is because you aren't comparing the same instances... it's a new instance every time you callnode.nextThis comment is hidden because it contains spoiler information about the solution
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.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...