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.
chill bro
It's almost like a hard coded solution but shrunk down to avoid taking too much space on the one line
Most likely because whoever wrote this didn't realize it can be solved in O(1). Or because this kata is listed in the section "LINQ excercises" so the author tried to solve it using System.Linq library. I don't think it can be solved in O(1) using language integrated query.
This is a ternary expression...
Although it's been 4 years, I guess you're not new to c# anymore.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator
It could be used "String.Concat(text.Select(...))" instead of join and nested ternary expressions usually frowned upon.
No need to convert to array.
Why use O(N) approach when it's a O(1) problem?
I don't get how this works :(
You can also Join IEnumerable values, so .ToArray() is not required, or I'm wrong?
Recursion is excellent to master if you intend to head into functional paradigm.
Could you please explain the return line (I'm new to c#) and don't understand (?,:)