dfs solution for subset generation problems