Hello, I am making a program that takes in an unspecified amount of integers inside an array and adds up the absolute values of the numbers. Look at the code to understand more.
@mbozzi, can you write the full the program?(because i dont understand why you are using transform_reduce)
and my program works fine. do i even need to change it? while it has no bugs or malfunctions?
Conceptually, each element is "transformed" by computing its absolute value. Then the list of absolute values is "reduced" into a single value by adding them together.
My program works fine. Do i even need to change it? while it has no bugs or malfunctions?
Of course not, yours is fine. But given the problem description
"Sum the absolute values of an array", transform_reduce or inner_product is a better fit.