https://www.hackerrank.com/challenges/journey-to-the-moon/problem the people in 1 component cant go together but thet can go with rest of the people */
| 6 | the people in 1 component cant go together but thet can go with rest of the people |
| 7 | */ |
| 8 | void dfs(int i,map<int,vector<int>>&m,vector<int>&visited,long long &temp) { |
| 9 | visited[i]=1; |
| 10 | temp++; |
| 11 | for(auto a:m[i]) { |
| 12 | if(visited[a]==0) { |
| 13 | dfs(a,m,visited,temp); |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | int journeyToMoon(int n, vector<vector<int>> astronaut) { |
| 18 | map<int,vector<int>> m; |
| 19 | for(auto a:astronaut) { |