TikTok interview question

two LC medium problems asked. Graphs, dfs, bfs, etc.