JAVA EASY SOLUTION
\nclass Solution {\n    \n    \n    public int  find(int x,int ds[]){\n        if(ds[x]==0)\n            return x;\n        return find(ds[x],ds);\n    }\n    \
```\nclass Solution {\n    \n    \n    public int  find(int x,int ds[]){\n        if(ds[x]==0)\n            return x;\n        return find(ds[x],ds);\n    }\n    \n    \n    \n    public int largestComponentSize(int[] nums) {\n        int max=Integer.MIN_VALUE;\n        for(int i:nums)\n            max=Math.max(max,i);\n          int ds[]=new int[max+1];\n          int size[]=new int[max+1];\n        Arrays.fill(size,1);\n        \n        for(int i=0;i<nums.length;i++){\n            int curr=nums[i];\n            for(int j=2;j<=Math.sqrt(curr);j++){\n                if(curr%j==0){\n                    int x=find(curr,ds);\n                    int y=find(j,ds);\n                    if(x!=y){\n                        if(size[x]>size[y])\n                        {\n                            ds[y]=x;\n                            size[x]+=size[y];\n                        }\n                        else{\n                            ds[x]=y;\n                            size[y]+=size[x];\n                            x=y;\n                        }\n                        \n                        \n                        \n                    }\n                    y=find(curr/j,ds);\n                    if(x!=y){\n                        if(size[x]>size[y]){\n                        ds[y]=x;\n                        size[x]+=size[y];\n                        }\n                        else{\n                            ds[x]=y;\n                            size[y]+=size[x];\n                        }\n                    }\n                }\n            }\n        }\n        int count[]=new int[max+1];\n        int res=1;\n        for(int i=0;i<nums.length;i++){\n           res=Math.max(++count[find(nums[i],ds)],res);\n        }\n        return res;\n        \n    }\n}\n```
[]