phatboislym

Untitled

Jan 15th, 2024
796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | Source Code | 0 0
  1. class Solution:
  2.     def findWinners(self, matches: List[List[int]]) -> List[List[int]]:
  3.         tally: dict = {}
  4.  
  5.         for match in matches:
  6.             for team in match:
  7.                 tally[team] = 0
  8.        
  9.         for match in matches:
  10.             tally[match[1]] += 1
  11.        
  12.         undefeated: list = [x for x in tally if tally[x] == 0]
  13.         one_loss: list = [x for x in tally if tally[x] == 1]
  14.  
  15.         undefeated.sort()
  16.         one_loss.sort()
  17.  
  18.         return [undefeated, one_loss]
  19.  
Advertisement
Add Comment
Please, Sign In to add comment