Split Array Largest Sum Leetcode Problems Javascript