Change the sign of every element of the float array Z in place (write the
negated values back into the same underlying buffer rather than allocating a new
array). Return the result.
Input
[-1. -0.75 -0.5 -0.25 0. 0.25 0.5 0.75 1. ]
Output
[ 1. 0.75 0.5 0.25 -0. -0.25 -0.5 -0.75 -1. ]
Only the returned value is graded, so a different approach will still pass. The constraint is the point of the exercise, not a rule the grader enforces.