Minimum Money Needed Leetcode Javascript 30