Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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 and b, and returns -1 if a < b, 0 if a == b and 1 if a > 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.