Minimum Sum Partition Leetcode Javascript Problems