TikTok Interview Question

4 programming problems including dfs and dp