Microsoft interview question

Coding test - 1 graph, 1 DP