Amazon interview question

1) One programming question on graph