Pregunta de entrevista de Snowflake

A dynamic programming problem which is level 'hard' on leetcode