Microsoft interview question

Dynamic Programming LC medium problem