Ad
  • Custom User Avatar

    I can see why that would be a concern, however if you look at both left and right, they are shortened with slice. Since left + right = arr, then left.reduce + right.reduce = arr.reduce, at least as far as the total length and amount of items reduced.

  • Custom User Avatar

    Hi there!

    I like the idea, but it performs reduce twice per each element.
    This is very inefficient in terms of performance. Please check my solution to see how to call reduce just once per the array.

    Regards