PwC interview question

Neetcode 150 one dsa from dynamic programming section