This comment is hidden because it contains spoiler information about the solution
Each time I create a chain list with a loop and you a to find the loop's size
"Thanks to shadchnev, I broke all of the methods from the Hash class."
Can't see your solution (I improved the test cases)
Don't see your solution . . .
this is codewars not codekindergarten ;-)
You should no touch the node, just use local variables inside the method
I tried your solution on compileonline.com and got a NoMethodError, I don't know why it works there. Put begin rescue and it solved the problem
You have a timeout ?
I run your code and indeed it should work when there is no tail. But all the test cases (except the first) have a tail and a loop so your code won't work which is normal.
What it returns is the size of the tail + loop not the loop only.
As i said in the description there is always a loop so the object_id should not increment infinitely.
I try to print the object_id as you did and i didn't see any problem with the id.
Maybe try to compare the object itself.
Perfect, your changes made me pass all the tests without changing anything !!!
Ok i think i understand the problem, my code change the value of your wishlist, so when you give me your wishlist as a parameter in the test 3 there is only 2 value in the array.
Got 2 and 2 when i print the variable of your wishlist and presents array for the third test while i got 3 and 2 for the first and second test
When I remove my code I got 3 and 2 for the third test instead of 2 and 2.
I hope you you understand me