Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
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)
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.
Thanks!
Thank you. Great feedback. I've updated the description.
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.
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.
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.
Thanks for calling this out. Fixed.
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.
Great, thank you for that. I've updated all of my kata.
This is great. s/should should/should/g in the last test case (that was my fault.)
Nice catch. Fixed. Thanks!
I've added this to the description. Thanks!
Fixed here and everywhere, thanks.
Loading more items...