Ad
  • Custom User Avatar

    Isn't that already in the kata's description?

    Use the `getNext()` method to get the following node.
    nodePtr->getNext()
    

    I don't think you needed a wild guess at all if you read it.

  • Custom User Avatar

    the kata is very easy (much easier than a 5-kyu kata should be), but the description is lacking the methods of Node class. It was a wild guess to use getNext() method on the Node class to switch to the next node in C++. I just checked the testing code, which had setNode() and decided to use a similar getNode() method. That is not right. You need to provide the description of all the methods you built in in your custom class Node.

  • 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

    In Java the "short_tail_long_loop" test fails. However, standard tests pass. Error "Incorrect loop size expected:<8778> but was:<4389>". So, at step 4389 I encountered a looped element, at least it had a match by hash (I used HashMap). How can this be?

  • Custom User Avatar
  • Custom User Avatar

    Seems broken for Kotlin. No Node implementation available. I like to code locally and not in the browser. Am I missing something?

  • Custom User Avatar

    Random tests generate 100 test cases, each with a list which has 10-20k nodes in the initial, "prefix" part, and 10-20k nodes in the loop part. Your solution is able to handle 3-5 such tests before timing out.

  • Custom User Avatar

    How did you fix this? Im confused because for me it just mentiones 3 passed test and random test timed out but it doesn't mention what exactly the random test was for me to debug the problem.

  • Custom User Avatar

    The intention behind the task is to solve it without hashing. However, some languages do not block this, and if you can use HashMap in your language to solve the challenge, good for you! But you will miss an opportunity to learn a nice algorithm :)

  • Custom User Avatar

    I don't understand the Hash part. Am I allowed to use a HashMap or not?

  • Custom User Avatar

    this kata is extremely useful in terms of getting what the Tortoise and Hare algorithm does (it detects the cycle in a smart way) AND what maybe even more important for Ruby (and I guess Python too) developers is the knowledge about object identity vs object equality. I spent hours trying to understand why my solution doesn't work: it was about to detect loop start node when we "come" to it from last tail node. and the thing is that it's not the same node as the-first-after-cycle-ended node even if you just compare it using "==" operator. and to be honest I'm still not sure why it's not and why I can detect equality of loop-start == loop-start-when-slow-and-fast-pointers-met nodes only when I do the second loop walkthrough (as standard solution suggests)

  • Custom User Avatar

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

  • Custom User Avatar

    The fact that objects have no attributs does not mean that they do not differ in any way form each other. They are different nodes, and you can easily check if they are the same, or different node.

    The fact that nodes have no readable property does not make the kata broken.

  • Custom User Avatar

    It's broken in php. $node->next() returns only the same object, which has nothing in it except the next method. Literally. What should I do with it if the objects don't even differ from each other in any way and it falls into an endless cycle?

      var_dump(get_object_vars($node));
      var_dump(serialize($node));
      $b = $node->getNext();
      var_dump(get_object_vars($b));
      var_dump(serialize($b));
    
    array(0) {
    }
    string(33) "O:4:"Node":1:{s:7:"*next";r:1;}"
    array(0) {
    }
    string(33) "O:4:"Node":1:{s:7:"*next";r:1;}"
    
  • Loading more items...