Editorial for Back From Summer '19 P1: Winnie's Orphans
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
We can loop through each orphanage, keeping a running minimum of which orphanage has the least number of children with a cuteness value of or . If the current orphanage has fewer such children than the running minimum, we update the best solution to the current orphanage's index. Otherwise, we move to the next orphanage.
Time Complexity:
Comments