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.
This comment is hidden because it contains spoiler information about the solution
The instructions stated that the strings only contain characters from a-z and you are checking that this is true. I do not think that that was intended. I figured they stated that so we don't get caught up in the question of international alphabets and how to count the character counts in them. But I may be wrong...
I like the use of Func, makes the whole thing really concise. The only thing I don't like about this, is that you iterate through each array twice, where once would suffice.
I am trying to come up with a way to do that using "getMinMaxLength Func<string[], Tuple<int, int>>", where you find the min and max in one iteration. I am not yet familiar enough with lambdas in C# to get it right without thinking longer about it. Do you know how?
My solution is kind of similar, but instead of returning an int array, I use out parameters for the minLength and maxLength. I think this makes it clearer for any potential user of the function that there will only be two values returned. Also, you then don't need to rely on your convention that i1[0] is the Min and i2[1] is the Max.
This comment is hidden because it contains spoiler information about the solution
I like that it is nice and clean and instantly understandable. However, this computes every possible combination of (x,y). That is really inefficient and lets the number of operations increase quadratically.
Let's assume a1 and a2 are of the same length. If they have 10 elements each, that is 100 times the inner loop is executed. If they have 100 elements, that is already 10k times the inner loop is executed!
We really don't know the context of this code which is always important to ensure we don't spend time optimizing code that is seldomly executed or with such input that any potential improvements would not be worth it.