Why throw away the value you already computed for the sums? the difference is just the value (or absolute value) of a[i].
Also the first element in the array can never be taken negative because it can never reach the second position.
Why throw away the value you already computed for the sums? the difference is just the value (or absolute value) of a[i].
Also the first element in the array can never be taken negative because it can never reach the second position.