01 · Question
Given an array of integers nums, return the pivot index where the sum of the numbers to the left equals the sum of the numbers to the right.
02 · Analysis
Compute total once. At index i, the right sum is total-left-nums[i]. Compare before adding nums[i] to left, so the pivot belongs to neither side. Return the first match; return -1 if none exists. Empty sides have sum zero. Time O(n), auxiliary space O(1).