Minimum Money Needed Leetcode Python