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 description doesn't explain clearly enough what the purpose of the passed in block is. The text reads like the block is used to "transform" each element (like what map does) and you then have to find the maximum of the resulting transformed array.
That's actually not what is required, despite the text making it seem so. The provided block acts as a comparator, that is, an integer-returning function which takes two arguments
a
andb
, and returns-1
ifa < b
,0
ifa == b
and1
ifa > b
.Your
max
method is then passed an array and this comparator. You are required to find the element in the array that would considered the "largest" when the array is sorted using the comparator to define the sort order.