Leetcode 1991 : Find the Middle Index in Array

preview_player
Показать описание
1991. Find the Middle Index in Array

Given a 0-indexed integer array nums, find the leftmost middleIndex (i.e., the smallest amongst all the possible ones).

Return the leftmost middleIndex that satisfies the condition, or -1 if there is no such index.

Рекомендации по теме
Комментарии
Автор

why you are running the rightPartSum form i= length-2 and not from length -1? You have ignored the last value.

manuchaudhary