Find Pivot Index

easy
1. You will be given an Array nums
 2. You need to return the first(if there are multiple) pivot index. Pivot index: An index where numbers to its left have the same sum as numbers to its right
 3. Input and output is handled for you
 4. It is a functional problem ,please do not modify main()
 NOTE: Return -1 if no such index exists

Input Format

Input is handled for you.

Output Format

Output is handled

Constraints

1<=N<=10^5
 -1000<=A[i]<=1000

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
6
1 3 2 2 1 1
Output
2
Next
Split Array Largest Sum

Related Questions