Microsoft interview question

A leet code medium question about using dynamic programming for array manipulation