Easy Java prefix sum solution
Intuition\nPrefix sum approach.\n\n# Approach\n1) Uses Prefix Sum Array approach\n2)  prefixSum[i] = prefixSum[i - 1] + arr[i];\n\n# Complexity\n- Time complexi
# Intuition\nPrefix sum approach.\n\n# Approach\n1) Uses Prefix Sum Array approach\n2)  prefixSum[i] = prefixSum[i - 1] + arr[i];\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minimumAverageDifference(int[] nums) {\n        \n int len=nums.length;\nlong sum=0;\nint index=0;;\nlong min=Integer.MAX_VALUE;\nlong leftSum=0,rightSum=0;\n\n\nfor(int i=0;i<len;i++){\n    sum+=nums[i];\n}\n\nfor(int i=0;i<len;i++){\n    leftSum+= nums[i];\n    \n\nlong avgLeftSum=leftSum/(i+1);\n\nrightSum=sum-leftSum;\nlong avgRightSum=0;\n\n   if(rightSum!=0){\n             avgRightSum=rightSum/(len-i-1);\n            }\n\n\nlong diff=Math.abs(avgLeftSum-avgRightSum);\n\nif(diff<min){\n    min=diff;\n    index=i;\n}\n}\n\nreturn index;\n    }\n}\n```
['Prefix Sum', 'Java']