Amazon Interview Question

topological sorting, snake and ladder problem