Ad
  • Custom User Avatar

    Thanks for the feedback!

    A linked list, in its simplest form, is just a sequence of nodes. I didn't include a linked list constructor function or class in any of these problems, and I neither does Nick Parlante (http://cslibrary.stanford.edu/105/LinkedListProblems.pdf).

    In place meaning call the function with the side effect being the reversal of the linked list (think of in place reversal of a c string).

    If you were using something like C, a pointer reference parameter would allow us to change the lead node. But JavaScript, along with most other languages, is pass by value (although you can change properties of objects, etc.), and does not have pointers, so you are right that the lead node must remain the lead node.

    I've removed the "in place" wording from the problem because, as you implied, the additional memory required could be the entire passed in list.

  • Custom User Avatar

    Hi Lysann, thanks for contributing to this Kata!

    Unfortunately there is currently not way to have custom descriptions for each language, so it's probably better to keep the description as is (using JavaScript conventions and syntax as the default). This is consistent with all of the other linked list kata.

    Please remove all description changes except for the addition of the ruby snippet (you can leave that in and I'll approve this translation);
    ```ruby
    insert_nth(1 -> 2 -> 3 -> nil, 0, 7) === 7 -> 1 -> 2 -> 3 -> nil)
    insert_nth(1 -> 2 -> 3 -> nil, 1, 7) === 1 -> 7 -> 2 -> 3 -> nil)
    insert_nth(1 -> 2 -> 3 -> nil, 3, 7) === 1 -> 2 -> 3 -> 7 -> nil)

  • Custom User Avatar

    Thanks for calling this out. Fixed. 2-space indentation is enforced where I work, but I should probably jump on the 4-space bandwagon when writing Kata since that's the standard.

  • Custom User Avatar
  • Custom User Avatar

    Thank you. Great feedback. I've updated the description.

  • Custom User Avatar

    I would like to support recursion for some of the other link list challenges, but I'll make an exception for this one or other challenges if you can make a case for it. As long the description mentions that tail recursion is not guaranteed to work here, I'm fine with it and will approve.

    Thank you for contributing.

  • Custom User Avatar

    It looks like this change has invalidated several recursive solutions for exceeding the call stack limit. Please update the description stating that recursive solutions are not guaranteed to work for this particular problem. Thanks.

  • Custom User Avatar

    This is great feedback, thanks. Testing for time complexity is a real pain and I'm not sure it's worth the effort. It takes a bit of tweaking to get right and, depending on the kata, there may not be a guarantee that the test assertion will actually weed out all O(n^2) solutions. I learned this the hard way when writing the longest 2-character substring kata. I appreciate your feedback!

    If you'd like to provide a test assertion, please send and I'll update the kata in all languages.

  • Custom User Avatar

    Thanks for calling this out. Fixed.

  • Custom User Avatar

    The problem states that the list will always be sorted in increasing order. Removing duplicates from an unordered list would be a great future Linked List problem to create, however.

  • Custom User Avatar

    Great, thank you for that. I've updated all of my kata.

  • Custom User Avatar

    This is great. s/should should/should/g in the last test case (that was my fault.)

  • Custom User Avatar

    Nice catch. Fixed. Thanks!

  • Custom User Avatar

    I've added this to the description. Thanks!

  • Custom User Avatar

    Fixed here and everywhere, thanks.

  • Loading more items...