Domanda di colloquio di TikTok

Dynamic programming question found on leetcode