java simple 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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public long  gcd(long a,long b)\n    {\n        while(a%b!=0)\n        {\n            long t=a%b;\n            a=b;\n            b=t;\n        }\n       return b;\n    }\n    public long maxScore(int[] nums) {\n        int n=nums.length;\n        if(n==1)\n        {\n            return nums[0]*nums[0];\n        }\n        int idx=0;\n        long ans=0;\n        while(idx<=n)\n        {\n            List<Integer>al=new ArrayList<>();\n            for(int i=0;i<n;i++)\n            {\n                if(idx!=i)\n                {\n                    al.add(nums[i]);\n                }\n            }\n            if(al.size()==1)\n            {\n                ans=Math.max(ans,al.get(0)*al.get(0));\n                idx++;\n                continue;\n            }\n            idx++;\n       long currentGCD = gcd(al.get(0), al.get(1));\n            long currentLCM = (al.get(0) * al.get(1)) / currentGCD;\n\n            for (int i = 2; i < al.size(); i++) {\n                currentGCD = gcd(currentGCD, al.get(i));\n                currentLCM = (currentLCM / gcd(currentLCM, al.get(i))) * al.get(i); // Safe LCM calculation\n            }\n\n            ans = Math.max(ans, (long) (currentGCD * currentLCM));\n        }\n        return ans;\n        \n    }\n}\n```
['Java']