answer of the same length as nums with all elements set to 0.leftSum and rightSum, to 0.nums array and store it in rightSum.nums array from left to right.
a. Subtract the current element from rightSum to get the sum of elements to the right.
b. Calculate the absolute difference between leftSum and rightSum and store it in the answer array at the current index.
c. Add the current element to leftSum.answer array.