Reshape a 1-D array into an array of different-size arrays

This seems applicable. Just adjust for the non-constant n.