Returns the first element of the array for which `fn(item)` is maximized.
If multiple elements have the same maximal weight, the earliest one is returned.
