• Using Ruby.

    #use this if you want to create your code on you computer the class of the node is in the description

    The the Node class is not in the description.

    When running "Test", I get an unexpected error:

    Response received but no data was written to STDOUT or STDERR.

    Even when I tried with a very simple solution that's wrong but should not "break":

    def loop_size(node)
      puts "Hello"
      0
    end
    
    • Python new test framework should be used (Refer this & this for more detail)

    • Ruby 3.0 should be enabled (Refer this & this for more detail)

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

  • I really enjoyed this kata and solved in both java and python. I was looking forward to reading the article but was having trouble finding it. Could the link to "Dmitry's article" please be added to the problem statement (Kata description) since I had trouble finding it. I was able to find it thanks to user: gayanw who posted the link as: http://blog.ostermiller.org/find-loop-singly-linked-list

    Thanks!

  • Python time restriction is too strict

  • I can't see the implementation of the Node class in PHP, so I'm not sure how to identify the node to check it. Is there some Node.ID attribute?

  • The function in JavaScript is named loop_size. According to Javascript conventions, it should follow camelCase, which means it should be called loopSize.

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

  • In some languages you can get away with mutating the nodes, like in Python and PHP (maybe in some others too).

  • There are some pending translations, and the author is long gone, so could any power-user check them and approve them if they're ok? I would do it, but the languages of those translations I'm not familiar enough with (C, C++).

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

  • it would be nice to add tests without loops

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

  • I had the problem that when I tested my algorithm it passed all provided tests in 350 or so ms, but when I submitted, the first test was a chain consistently longer than 30 million nodes, which resulted in a time out. I did improve my code, but the tests provided seem to be smaller as well, since they were passed in a very short time. There might be something funky with the tests.

  • I have succesfully passed all the tests, even though I made a basic mistake of reusing my collection for every run.

    So if you would run the same set twice through the same instance in my solution, then the first time you get the requested result.
    The second and consequential attempts you'll get 0 as result.

    So can I get the loop? yes, but possibly only once per instance.
    So if you could change the next node with a function, through which the loop size will change,
    then the first time I give the right result, and the next run I will give completely false results.

    If you think this mistake falls within the kata to prevent then perhaps you could add this testcase to the tests?

  • Loading more items...