Given an array of integers, calculate the pivot index of the array, which is the index where the sum of all numbers strictly to the left is equal to the sum of all numbers strictly to the right. Return the leftmost pivot index. If no such index exists, return -1.
Click Run to execute sample tests.