TikTok interview question

Data structures and dynamic programming