Amazon Interview Question

A linked list and a graph question