Maximum Subarray Leetcode Javascript Problems