Given an array of ints, return the index such that the sum of the elements to the right of that index equals the sum of the elements to the left of that index. If there is no such index, return `-1`. If there is more than one such index, return the left-most index.

For example: 
```
peak([1,2,3,5,3,2,1]) = 3, because the sum of the elements at indexes 0,1,2 == sum of elements at indexes 4,5,6. We don't sum index 3.
peak([1,12,3,3,6,3,1]) = 2
peak([10,20,30,40]) = -1
```

The special case of an array of zeros (for instance `[0,0,0,0]`) will not be tested. 

More examples in the test cases. 

Good luck!

Please also try [Simple time difference](https://www.codewars.com/kata/5b76a34ff71e5de9db0000f2)

Difficulty: introductory

Starter code:

def peak(arr):
	

Solutions:
def peak(arr):
    for i, val in enumerate(arr):
        if sum(arr[:i]) == sum(arr[i+1:]):
            return i
    return -1

def peak(arr):
    for i in range(len(arr)):
        if sum(arr[:i]) == sum(arr[i+1:]): return i
    return -1

def peak(arr):
    sl, sr = 0, sum(arr)
    for i,v in enumerate(arr):
        sr -= v
        if sr == sl: return i
        elif sl > sr: return -1
        sl += v


def peak(arr):
    for i,n in enumerate(arr):
        if sum(arr[:i]) == sum(arr[i+1:]):
            return i
    else:
        return -1


def peak(arr):
    r = sum(arr)-arr[0]
    l = 0
    if l == r: return 0
    for i in range(len(arr)-1):
        l += arr[i]
        r -= arr[i+1]
        if l == r: return i+1
    return -1

def peak(arr):
    l=[i for i in range(len(arr)-1) if sum(arr[:i])==sum(arr[i+1:])]
    return l[0] if l else -1

def peak(arr):
  return next(iter(i for i in range(len(arr)) if sum(arr[:i]) == sum(arr[i+1:])), -1)

from itertools import accumulate
def peak(arr):
    for idx,(a,b) in enumerate(zip(list(accumulate(arr))[:-2],list(accumulate(reversed(arr)))[-3::-1])):
        if a == b: return idx+1
    
    return -1

peak=lambda a:sum(sum(a[y+1:])==sum(a[:y])and y for y,_ in enumerate(a))or-1

def peak(arr):
    left_sum, right_sum = [0], [0]
    for n in arr: left_sum.append(n + left_sum[-1])
    for n in arr[::-1]: right_sum.append(n + right_sum[-1])
    for i in range(len(arr)):
        if right_sum[len(arr)-1-i] == left_sum[i]: return i
    return -1