How to find the minimum number of frogs croaking in LeetCode problem 1419?