All Posts
Leetcode 2225: Find Players With Zero or One Losses
You are given an array matches
where each element matches[i] = [winneri, loseri]
indicates that player winneri
defeated player loseri
in a match. Your task is to return a list answer
of size 2 where:
answer[0]
contains the list of players who have never lost a match.answer[1]
contains the list of players who have lost exactly one match.
The players in both lists should be sorted in increasing order.