Given a nums, determine an array answer of the same length such that:
answer[i] = |leftSum[i] - rightSum[i]|
Where:
leftSum[i] represents the sum of elements located to the left of index i in nums. If no elements exist to the left, leftSum[i] = 0.
rightSum[i] represents the sum of elements located to the right of index i in nums. If no elements exist to the right, rightSum[i] = 0.
Return the array answer.
Constraints:
nums.length
nums[i]
Given a nums, determine an array answer of the same length such that:
answer[i] = |leftSum[i] - rightSum[i]|
Where:
leftSum[i] represents the sum of elements located to the left of index i in nums. If no elements exist to the left, leftSum[i] = 0.
rightSum[i] represents the sum of elements located to the right of index i in nums. If no elements exist to the right, rightSum[i] = 0.
Return the array answer.
Constraints:
nums.length
nums[i]