Medium
,Array
,Hash Table
,Sorting
,Counting
2225. Find Players With Zero or One Losses
You are given an integer array matches
where matches[i] = [winner i, loser i]
indicates that the player defeated player in a match.
Return a list answer
of size 2
where:
answer[0]
is a list of all players that have not lost any matches.answer[1]
is a list of all players that have lost exactly one match.The values in the two lists should be returned in increasing order.
Note:
Example 1:
Example 2:
Constraints:
matches.length
<= matches[i].length
== 2matches[i]
are unique.Time complexity :
這裡k最大為lossCount.length
是100000
Marsgoat Nov 28, 2022
Yen-Chi ChenMon, Nov 28
Yen-Chi ChenMon, Nov 28
Kobe BryantMon, Nov 28