Simple Easy Java Solution
Code\njava []\nclass Solution {\n    private int gcd(int a, int b) {\n        if (b == 0) {\n            return a;\n        }\n        return gcd(b, a % b);\n  
# Code\n```java []\nclass Solution {\n    private int gcd(int a, int b) {\n        if (b == 0) {\n            return a;\n        }\n        return gcd(b, a % b);\n    }\n\n    private long gcd(long a, int b) {\n        if (b == 0) {\n            return a;\n        }\n        return gcd(b, (int) (a % b));\n    }\n\n    public long maxScore(int[] nums) {\n        int n = nums.length;\n\n        // edge\n        if (n == 1) {\n            return (long) nums[0] * nums[0];\n        }\n\n        int tgcd = nums[0];\n        long tlcm = nums[0];\n        for (int i = 1; i < nums.length; i++) {\n            tgcd = gcd(tgcd, nums[i]);\n            tlcm = (tlcm * nums[i]) / gcd(tlcm, nums[i]);\n        }\n\n        long maxScore = tgcd * tlcm;\n        for (int i = 0; i < n; i++) {\n            int ngcd = 0;\n            long nlcm = 1;\n            for (int j = 0; j < n; j++) {\n                if (i != j) {\n                    ngcd = ngcd == 0 ? nums[j] : gcd(ngcd, nums[j]);\n                    nlcm = (nlcm * nums[j]) / gcd(nlcm, nums[j]);\n                }\n            }\n\n            maxScore = Math.max(maxScore, ngcd * nlcm);\n        }\n        return maxScore;\n    }\n}\n```
['Java']