Domanda di colloquio di Wingify

he asked me one puzzle question, one DP problem,