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.
< and > in the context of [[ ]] sort lexicographically not numerically. By accident, the solution works nevertheless.
You can definitely make the argument that the average of an empty list is undefined because [0,] != [ ], and that returning NaN is more semantically correct. Saying it SHOULD be invalidated is a tad strong. There is a convention stating that the sum of zero elements is 0, but I don't know of any convention stating that the average should be 0. Imo an empty list can't have a well-defined mean.
Damn, I completely forgot about bitwise operators! Nice solution bro.
still clever for setting init to a double
Division of 0.0 by 0.0 is NaN. This solution should be invalidated and the empty array added to the test cases.
I feel like I always take the longest path with my codes when I see other people's.
This is really the smart and correct way to handle this kata.