IXL Learning interview question

Some dfs & backtracking problem and analyze complexity.