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.
Yeah, that combination is really best! Thank you for the update :)
Yes and no.
So in the end, the actual best practice would be to combine both approaches.
This solution maybe clever, but as for me it's unreadable.
PEP8 recommended max line length is 79.
So I think it shouldn't be considered as best practice.
Check the solution from @bidouille. I liked it.
Really nice solution. However truncating hello to hell makes it weird
got it. Thank you @Azuaron for explanation!
It doesn't recreate the whole list. It recurses through the list until it finds the correct index, then inserts the new Node at that location. If you're referring to
head.next = insert_nth(head.next, index - 1, data)
, that doesn't "recreate" anything, it just sets the new assignment which, in most cases, is the same as the old assignment.If the linked list contains that many elements, then this function will fail. However, lists of that size were not part of this kata. That being said, if I wrote this again, I'd make it tail recursive, and then the list size would not be limited by the stack size.
nice Square subclassing :)
I like BeautifulSoup better
Could anyone explain why this solution is 'Best Practice'?
Looks like we conplitely recreate whole list here instead of adding the needed element into the index position.
What if the linked list contains 1500 elements? Won't we get the RecursionError?
This solution works. But I think shouldn't be considered as best practices or clever solution since can be optimized
This comment is hidden because it contains spoiler information about the solution
We can do that in a for loop using predefined dictionary
wow
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...