Genesys Interview Question

Leetcode question in dynamic programming