Find Pivot Index LeetCode solution in Python
1# Runtime: 342 ms (Top 15.25%) | Memory: 15.2 MB (Top 92.14%)2class Solution:3def pivotIndex(self, nums: List[int]) -> int:4right = sum(nums)5left = 067for i in range(len(nums)):8right -= nums[i]9left += nums[i - 1] if i > 0 else 01011if right == left:12return i1314return -1