Amazon interview question

topological sorting, snake and ladder problem