Amazon OA Question

Anonymous User
16987

I flubbed on this question if anyone would want to give it a shot.

To assemble an Amazon robot, we are given N components labeled from 0 ~ N-1.
There are order requirements to put some components given by an array of pair [pre, post]
which means pre must be installed before post. Write a solution to determine if all the components
can be assmbled successfully.
ex [[0,1],[1,2],[2,0]] returns false

Basically make sure there's no cyclical relationships.

Comments (12)