Amazon Interview Question

Topo sort and easy design using Java