68. Means of Subsets

Hard

Given a vector D and a same-size integer vector S of subset indices, compute the mean of D within each subset. Return an array where entry i is the mean of the D values whose corresponding S entry equals i, for i from 0 up to the largest value in S.

Implement solve(...)