Practice Find Players With Zero or One Losses
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Each matches entry [winner,loser] records one result. Return two ascending lists: players with zero losses and players with exactly one loss. Include only players who appeared in at least one match; repeated identical match outcomes do not occur.
Source: Find Players With Zero or One Losses on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
matches = [[1,3],[2,3],[3,6],[5,6],[5,7],[4,5],[4,8],[4,9],[10,4],[10,9]]
Output
[[1,2,10],[4,5,7,8]]
# Example 2
Input
matches = [[2,3],[1,3],[5,4],[6,4]]
Output
[[1,2,5,6],[]]
Constraints
1 <= matches.length <= 10^5
matches[i].length == 2
1 <= winneri, loseri <= 10^5
winneri != loseri
All matches[i] are unique.
Related LeetCode Problems
Practice more problems similar to Find Players With Zero or One Losses.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.