Ad
  • Custom User Avatar

    Well as the problem was just to return only one winner, I just evicted duplicates, which doesn't allow the other problem where you would want to return an ordered list of "winners" (?)
    If that was the case, I would obviously choose another method to keep my results ordered (maybe an OrderedDict like you did)

  • Custom User Avatar

    scores only store the first candidate for each total score when iterating candidates, which is ordered, and so the order is "preserved" as I evict all duplicates (look at the setdefault method usage)

    Maybe I shouldn't have used a dictionnary for this and just stored a winner variable updated when seeing a candidate with a better score, this would have been easier to read I think.