Maximum Good Subarray Sum Leetcode Javascript Problems