标签:var return etc ret int nbsp [] index length
public class Solution { public int PivotIndex(int[] nums) { if (nums.Length == 0) { return -1; } var left = 0; var right = nums.Sum() - nums[0]; if (left == right) { return 0; } for (int i = 1; i < nums.Length; i++) { left += nums[i - 1]; right -= nums[i]; if (left == right) { return i; } } return -1; } }
标签:var return etc ret int nbsp [] index length
原文地址:https://www.cnblogs.com/asenyang/p/9734464.html