Microsoft interview question

Trees, Graphs, DP, Sorting and complexity analysis