TikTok interview question

Two leetcode hard problem and two medimum problem