write reduceArraySkeleton