Ad
  • Default User Avatar

    I was wondering that myself, niklasb, but then I found this on Wikipedia:
    "If the input is given as a subroutine for calculating ƒ, the cycle detection problem may be trivially solved using only λ+μ function applications, simply by computing the sequence of values xi and using a data structure such as a hash table to store these values and test whether each subsequent value has already been stored. However, the space complexity of this algorithm is λ+μ, unnecessarily large. Additionally, to implement this method as a pointer algorithm would require applying the equality test to each pair of values, resulting in quadratic time overall. Thus, research in this area has concentrated on two goals: using less space than this naive algorithm, and finding pointer algorithms that use fewer equality tests."

  • Default User Avatar

    Incorrectly converts THE-STEALTH-WARRIOR into THESTEALTHWARRIOR instead of into TheStealthWarrior

  • Custom User Avatar

    what the heck kind of restriction is that?! How is one solution "better" than the other if it has the same asymptotic complexity, same code length and same real-world performance. That's just arbitrary.

  • Default User Avatar

    You should tell that Hash has been disabled in the instructions. I was trying my solution and wondering why it didn't work at all!

  • Custom User Avatar

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

  • Custom User Avatar

    It's a really nice kata but I'd disable the Hash class for it. Using a hash isn't really a point of this kata – there are far better ways (see the author's solution).

  • Custom User Avatar

    Rather impressive. Took me a couple minutes to understand how it works :) Really smart solution.