ap
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\nint find(int n,vector<int>&par)\n{\n    if(n==par[n])return n;\n    return par[n]=find(par[n],par);\n}\nvoid join(int u,int v,vector<int>&size,vector<int>&par)\n{\n    int pu=find(u,par);\n    int pv=find(v,par);\n    if(pu==pv)return;\n    if(size[pu]>size[pv])\n    {\n        size[pu]+=size[pv];\n        par[pv]=pu;\n    }else\n    {\n        size[pv]+=size[pu];\n        par[pu]=pv;\n    }\n}\n    vector<bool> friendRequests(int n, vector<vector<int>>& re, \n    vector<vector<int>>& req) {\n        vector<int> size(n,1),par(n,0);\n        for(int i=0;i<n;i++)par[i]=i;\n        vector<bool> ans;\n        for(auto i:req)\n        {\n            int f=1;\n            for(auto j:re)\n            {\n                if((find(j[0],par)==find(i[0],par)&&find(j[1],par)==find(i[1],par))||(find(j[0],par)==find(i[1],par)&&find(j[1],par)==find(i[0],par)))\n                {\n                    f=0;\n                }\n            }\n            if(f)\n            {\n                ans.push_back(true);\n                join(i[0],i[1],size,par);\n            }else\n            {\n                ans.push_back(false);\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']