Amazon Interview Question

Leetcode medium level arrays and graph traversal