
Note I mis-spoke during the meeting because you need to sort the hash-map keys in order to figure out how many cows are able to pay.
Key idea for implementation: Group your input with a hashmap, where keys are the max amount a cow is willing to pay, and the values are the number of cows with that pay key.
Then loop over each key the same way you did with the brute force.
You can reach out to me at ddjapri@ayclogic.com if you have any questions!
You can find class notes here (Tues7PM_IntroToCompProgramming is our excel sheet for visuals).