Maximum Good Subarray Sum Leetcode Problems Java