Google interview question

Leet code hard DSA question about dynamic programming