Java Solution | Union Find | Disjoint Sets | Without rank
```\nclass Solution {\n    public boolean[] friendRequests(int n, int[][] restrictions, int[][] requests) {\n        int[] arr=new int[n];\n        for(int i=0;
```\nclass Solution {\n    public boolean[] friendRequests(int n, int[][] restrictions, int[][] requests) {\n        int[] arr=new int[n];\n        for(int i=0;i<n;i++){\n            arr[i]=i;\n        }\n        int j=0;\n        boolean[] ret=new boolean[requests.length];\n        for(int[] a:requests){\n            int x=find(a[0],arr);\n            int y=find(a[1],arr);\n            boolean flag=true;\n            for(int i=0;i<restrictions.length;i++){\n                int l=find(restrictions[i][0],arr);\n                int r=find(restrictions[i][1],arr);\n                if(((l==x && r==y) || (l==y && r==x))){\n                    flag=false;\n                    break;\n                }\n            }\n            ret[j++]=flag;\n            if(flag){\n                union(x,y,arr);\n            }\n        }\n        return ret;\n    }\n    private void union(int a,int b,int[] arr){\n        int x=find(a,arr);\n        int y=find(b,arr);\n        if(x==y) return;\n        arr[y]=x;\n    }\n    private int find(int x,int[] arr){\n        if(arr[x]==x) return x;\n        return find(arr[x],arr);\n    }\n}
['Union Find', 'Java']