c++||Union Find||Easy to Understand
```\nclass Solution {\npublic:\n    int find(vector &par,int u)\n    {\n        if(u==par[u])\n            return u;\n        return par[u]=find(par,par[u]);\n 
```\nclass Solution {\npublic:\n    int find(vector<int> &par,int u)\n    {\n        if(u==par[u])\n            return u;\n        return par[u]=find(par,par[u]);\n    }\n    void merge(vector<int> &par,int u,int v)\n    {\n        int pu=find(par,u);\n        int pv=find(par,v);\n        \n        par[pv]=pu;\n    }\n    vector<bool> friendRequests(int n, vector<vector<int>>& restrictions, vector<vector<int>>& requests)\n    {\n        int m=requests.size();\n        vector<bool> ans(m,true);\n        vector<int> par(n);\n        for(int i=0;i<n;i++)\n        {\n            par[i]=i;\n        }\n        for(int i=0;i<requests.size();i++)\n        {\n            int p=find(par,requests[i][0]);\n            int q=find(par,requests[i][1]);\n            if(!(find(par,p)==find(par,q)))\n            {\n                for(auto &rs:restrictions )\n                {\n                    int x=find(par,rs[0]),y=find(par,rs[1]);\n                    {\n                        if((x==p&&y==q)||(x==q&&y==p))\n                        {\n                            ans[i]=false;\n                            break;\n                        }\n                    }\n                }\n                if(ans[i])\n                {\n                    merge(par ,p,q);\n                }\n            }\n            \n        }\n        return ans;\n        \n    }\n};\n// if you like the solution plz upvote.
['Union Find', 'C']