TikTok interview question

medium , permutation, backtrack , bfs and dfs