TikTok Interview Question

A Leetcode dynamic programming question