TikTok Interview Question

There was a dynamic programming problem.