Bloomberg interview question

graph problem