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.
I would never think about reduce and recursive stuff, for sure is a good skill to think about.
You would love this kata where lines are restricted to 2 characters >:)
https://www.codewars.com/kata/5935558a32fb828aad001213/javascript
Well, here in codewars, one-liners are actually best practice ;)
I think, its a bad ptactice to write a code in one line. It's a my opinion, I'm not a hater)) gl ;)
Wery intresting : ) but I'm din't understand your it
I've checked this very example in Python and the logic is the same, no error raised.
Oh okay, thanks so much for explaining it to me!
Function can call another function. Let's say the function has been already executed (Stringify) and the flow reached the line "Stringify(list.Next)". At this moment function has been already initiated as the flow "already works" so no error would be rised - but because we are calling same function it is called recursion ... and recursion works for python as well.
I guess my confusion is just how Stringify() is called within the definition for Stringify()?
If I'm remembering correctly, in Python, this would raise an error stating that the method/function can't be called before its been initiated or something along those lines.
First of all study Node class really carefully. You will recognize that Node.data actually holds an integer and Node.next holds...another object Node which holds ... yes an integer and another object of type Node...and so one till Node.next holds null. I suggest to take a look closer at recursion as "conceptually" will not be enough to understand this very example. Answering your questions: When you call Stringify(list.Next) you are calling the method with object Node. Integer of that object is concatenatted to the resulted string (recursively) As i said earlier on Node.next holds another object Node or null. I would call it a tail recursion.
I'm new to C#, and I'm curious what's going on when you call Stringify(list.Next) from within Stringify(Node list); ?
Is this what Manimu means by tail recursion?
I'm also new to data structure so I only really know recursion conceptually.
Great Solution!
It's all about two lines, while I spread a 'mudyanka' in my code))