Intuit Interview Question

It was a kinda easy graph problem.