Ad
  • Default User Avatar

    Why? You are reducing to a single number according to the data ops. The only time there is no operation on that number is for operation o , which just pushes the number to the main function's output array. Seems pretty straightforward.
    I've done it a bit differently in that my reduce function builds the main output array but I like this top solution, focusing on the number itself.