func pivotIndex(nums []int) int { for i:=0;i<len(nums);i++ { leftRes, rightRes := 0, 0 if i > 0{ for _, j := range nums[:i] { leftRes += j } } if i < len(nums) - 1 { for _, k := range nums[i:] { rightRes += k } rightRes -= nums[i] } if leftRes == rightRes { return i } } return -1 }