Amazon interview question

Topo sort and easy design using Java