Skip to content

#724 - Find Pivot Index

EasyPrefix Sum
Open on LeetCode

Given an integer array nums, return the leftmost pivot index. The pivot index is where the sum of all elements strictly to the left equals the sum of all elements strictly to the right. If no such index exists, return -1. An element at the edge has 0 on one side.

InputOutput
nums = [1,7,3,6,5,6]3
nums = [1,2,3]-1
nums = [2,1,-1]0

Released under the MIT License.