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.
Linq Select has an override that gives you the index of the current item in the selector (that index is the same number of times you need to repeat). I used Repeat didn't realize there was a string constructor overload that does the same.
Also totally forgot about string.Join. Much cleaner code than I wrote on my first pass.
decided to diversify the same solutions :D
This comment is hidden because it contains spoiler information about the solution
You're returning the last number that's only one digit, read the instructions again:
You only have to check if the array is not empty, as easy as that. Fix your code and it'll work.
I love this website because you get to see a lot more of the niche pieces of code, which can be overlooked :)
This is a property which can be pulled through if you want it. I could of named it anything. One the where linq, if you select to name properties (in this case "index"), it will create a property which contains the current interations index. There is another property which can also be pulled through (pretty sure there are 3 properties (1: item of the list, 2: index). Anyway the second name in (n,index) is to reference the index.
Or as Visual Studio 2017 puts it:
Filters a sequence of values based on a predicate. Each element’s index is used in the logic of the predicate function.
Predicate: A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
Anyway... I know both the Select and Where Linq methods allow you to pull through the index.