@@ -0,0 +1,538 @@
+package leetcode;%0A%0A/**%0A * https://leetcode.com/problems/find-the-middle-index-in-array/%0A */%0Apublic class Problem1991 %7B%0A    public int findMiddleIndex(int%5B%5D nums) %7B%0A        int totalSum = 0;%0A        for (int num : nums) %7B%0A            totalSum += num;%0A        %7D%0A        int leftSum = 0;%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            int rightSum = totalSum - leftSum - nums%5Bi%5D;%0A            if (leftSum == rightSum) %7B%0A                return i;%0A            %7D%0A            leftSum += nums%5Bi%5D;%0A        %7D%0A        return -1;%0A    %7D%0A%7D%0A

Solve problem 1991