Need help with an interview problem

Правка en1, от apjcoder123, 2025-02-02 09:34:58

Hi community,

Recently I came across a problem:

There is a chess contest between N players. Each chess player has a distinct rank (positive integer number from 1 to N). We assume that in a chess game between two players, the player ranked higher always wins. The ranks remain constant during the contest. Unfortunately, we don't know the player ranks. But we know the outcome of M games in the following format: Player #1 won #2 Player #2 won #4 .... Given the results of M games above, are there any players whose rank can be precisely determined? If so, find their ranks.

I'll be grateful if someone can help with approach to this problem, given that we can have multiple nodes with indegree 0 and outdegree 0.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский apjcoder123 2025-02-02 09:34:58 763 Initial revision (published)