Amazon interview question

Amazon graph question