Зареждане на задачата…
Imagine a row of numbers like a balance scale: one sum on the left, another on the right. Given a list arr, return the first index where the sum of all elements to the left equals the sum of all elements to the right. The element at that index is not included in either sum. If no such index exists, return -1.
[-7, 1, 5, 2, -4, 3, 0]3[1, 2, 3, 4, 5]-1[1, 1, 1, 1, 1]2def equilibrium_index(arr: list[int]) -> int:
Влез, за да видиш историята на решенията
ВходВлез, за да използваш ИИ ментора
Вход[-7,1,5,2,-4,3,0]3[1,2,3,4,5]-1[1,1,1,1,1]2[2,4,6,8,10,3]-1[1,2,3,4,5,1]3[-6,2,6,3,-3,4,1]3