Pergunta de entrevista da empresa Genesys

Leetcode question in dynamic programming