Maximum Sum Path Leetcode Problems Javascript