Java Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(n^2)\n- Space complexity:\nO(1)\n# Code\n```java []\nclass Solution {\n    public long maxScore(int[] nums) {\n        if (nums.length == 1) {\n            return (long) nums[0] * nums[0];\n        }\n        long ans = score(nums, -1);\n        for (int i = 0; i < nums.length; i++) {\n            ans = Math.max(ans, score(nums, i));\n        }\n        return ans;\n    }\n\n    long score(int[] nums, int skip) {\n        long lcm = skip != 0 ? nums[0] : nums[1];\n        long gcd = skip != 0 ? nums[0] : nums[1];\n        for (int i = 0; i < nums.length; i++) {\n            if (i == skip) {\n                continue;\n            }\n            gcd = GCD(gcd, nums[i]);\n            lcm = LCM(lcm, nums[i]);\n        }\n        return lcm * gcd;\n    }\n\n    long GCD(long a, long b) {\n        while (b != 0) {\n            long temp = b;\n            b = a % b;\n            a = temp;\n        }\n        return a;\n    }\n\n    long LCM(long a, long b) {\n        return (a / GCD(a, b)) * b;\n    }\n}\n\n```
['Java']