Given a result of a competition among all the students of a class, write a program to make students stand in a order such that every student must have lost to the student in his/her immediate left and won against the student to his/her immediate right.
This kind of looks like topological sort, but how to handle cycles?
Is there any similar problem in leetcode. Thanks.