Getting TLE on a dfs problem
I am getting a TLE on this problem using DFS. This is my . Can someone suggest some optimizations?