O(n^2) Time complexity. Easy solution✅✅✅.
\n\n# Code\njava []\nclass Solution {\n    long gcd(long a,long b)\n    {\n        if(a%b==0)\n        {\n            return b;\n        }\n        else\n      
\n\n# Code\n```java []\nclass Solution {\n    long gcd(long a,long b)\n    {\n        if(a%b==0)\n        {\n            return b;\n        }\n        else\n        {\n            return gcd(b,a%b);\n        }\n    }\n    long calculateLCM(long a,long b)\n    {\n        return ((a/gcd(a,b))*b);\n    }\n    public long maxScore(int[] nums) {\n        if(nums.length==0)\n        {\n            return 0;\n        }\n        else if(nums.length==1)\n        {\n            return nums[0]*nums[0];\n        }\n        else\n        {\n            int[] lcms=new int[nums.length];\n            int[] gcds=new int[nums.length];\n            for(int i=0;i<nums.length;i++)\n            {\n                long lcm=i==0?nums[1]:nums[0];\n                for(int j=0;j<nums.length;j++)\n                {\n                    if(i!=j && lcm!=nums[j])\n                    {\n                        lcm=calculateLCM(lcm,nums[j]);\n                    }\n                }\n                lcms[i]=(int)lcm;\n            }\n            for(int i=0;i<nums.length;i++)\n            {\n                long g=i==0?nums[1]:nums[0];\n                for(int j=0;j<nums.length;j++)\n                {\n                    if(i!=j && g!=nums[j])\n                    {\n                        g=gcd(g,nums[j]);\n                    }\n                }\n                gcds[i]=(int)g;\n            }\n            int[] mul=new int[nums.length];\n            long max=0;\n            for(int i=0;i<lcms.length;i++)\n            {\n                mul[i]=lcms[i]*gcds[i];\n                if(max<mul[i])\n                {\n                    max=mul[i];\n                }\n            }\n            long globallcm=nums[0];\n            long globalgcd=nums[0];\n            for(int i=1;i<nums.length;i++)\n            {\n                globallcm=calculateLCM(globallcm,nums[i]);\n                globalgcd=gcd(globalgcd,nums[i]);\n            }\n            long max2=globallcm*globalgcd;\n            return Math.max(max,max2);\n        }\n    }\n}\n```
['Java']