games[i] = [a, b] means player a beat player b. There are no draws, and the same record (same winner and same loser) never appears twice.
Return two lists:
- the players who have not lost a single game;
- the players who have lost exactly one game.
Only players who played at least one game count. Each list must be in increasing order.games=[[4, 9], [9, 2], [4, 2], [7, 4]] → [[7], [4, 9]]
Player 7 never lost. Players 4 and 9 lost one game each, while 2 lost twice and is left out.
games=[[1, 2], [2, 1], [3, 1]] → [[3], [2]]
Only 3 has no losses; 2 lost once and 1 lost twice.
games=[[10, 20]] → [[10], [20]]
games[i] are distinctgames=[[4, 9], [9, 2], [4, 2], [7, 4]]
[[7], [4, 9]]
Run checks the first 3 tests in your browser. Submit checks all 69 tests on the server, hidden ones included.