Free written solution

Find the Middle Index in Array (LeetCode 1991): Solution and Explanation

Return the leftmost index where the elements to its left add up to the same value as the elements to its right, or -1 if there is no such index.

Read the intuition, approach, code and complexity →