My idea is to use topological sort using BFS and output the max level the BFS reaches.
During BFS, If the indegree of child becomes 0, and the child's node number is greater than the parent node number, i'll push it into the queue without changing the level because this chapter will be understood in the current iteration itself . If the child's node number is lesser, i'll increment the level and push it into the queue because this chapter will require one more iteration to understand.
This solution fails on some case. What's wrong in this solution?
Here is my submission : 129318461