diff options
124 files changed, 3580 insertions, 422 deletions
diff --git a/challenge-321/matthias-muth/README.md b/challenge-321/matthias-muth/README.md index 45ded22b4b..a00f1d2dc0 100644 --- a/challenge-321/matthias-muth/README.md +++ b/challenge-321/matthias-muth/README.md @@ -54,20 +54,33 @@ I think that the easiest way to do this is to first sort the array numerically: @nums = sort { $a <=> $b } @nums; ``` -Then, we have the minimum in the first entry, and the maximum in the last one.<br/> -It's easy to get and remove those two from the array at the same time: we can use `shift` to get and remove the first one (the minimum) , and `pop` to do the same for the last one (the maximum).<br/> +Then, we have the minimum in the first entry +and the maximum in the last one.<br/> +It's easy to get and remove those two from the array at the same time: +we can use `shift` to get and remove the first one (the minimum), +and `pop` to do the same for the last one (the maximum).<br/> So the average is this: ```perl ( shift( @nums ) + pop( @nums ) ) / 2 ``` -We will be doing this in a loop, as long as we still have at least two numbers (for the average) in the array. +We will be doing this in a loop, +as long as we still have at least two numbers +(for calculating their average) in the array. But how do we count the *distinct* averages? -Someone [said](https://perldoc.perl.org/perlfaq4#How-can-I-remove-duplicate-elements-from-a-list-or-array?) 'When you think the words "unique" or "duplicated", think "hash keys"'.<br/>"Unique" and "distinct" are very often used interchangeably, even though they don't mean exactly the same.<br/> -But in any case, a hash helps us to find the number of *distinct* values of averages:<br/>Whenever we have computed an average value, we create a hash entry with that value as a key, for example by assigning a value of `1` to it: +Someone +[said](https://perldoc.perl.org/perlfaq4#How-can-I-remove-duplicate-elements-from-a-list-or-array?) +'When you think the words "unique" or "duplicated", think "hash keys"'.<br/> +"Unique" and "distinct" are very often used interchangeably, +even though they don't mean exactly the same thing.<br/> +But no matter what, +a hash helps us to find the number of *distinct* values of averages:<br/> +Whenever we have computed an average value, +we create a hash entry with that val |
