TikTok interview question

There was a dynamic programming problem.