class Solution {
    public int pivotIndex(int[] nums) {
        int sum = 0;
        int lSum = 0;
        
        for(int num : nums)
        	sum += num;
        
        for (int i = 0; i < nums.length; i++) {
			if(lSum == sum - lSum - nums[i])
				return i;

			lSum += nums[i];
		}
        return -1;
    }
}