Bloomberg Interview Question

graph problem