Split With Minimum Sum Leetcode Python