Simple and Easy JAVA Solution , Brute Force approach
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 maxScore(int[] nums) {\n        if(nums.length == 0)\n            return 0;\n        if(nums.length == 1)\n            return nums[0] * nums[0];\n\n        long max = findAns(nums,-1);\n\n        for(int i=0;i<nums.length;i++)\n            max = Math.max(max , findAns(nums,i));\n        \n        return max;\n    }\n\n    private static long findAns(int nums[],int ind){\n        long gcd = ind == 0 ? nums[1] : nums[0];\n        long lcm = gcd;\n        for(int i= (ind == 0 ? 2 : 1);i<nums.length;i++){\n            if(i != ind){\n                gcd = gcd(gcd,(long)nums[i]);\n                lcm = (lcm * nums[i]) / gcd(lcm ,(long)nums[i]);\n            }\n        }\n\n        return gcd * lcm;\n    }\n\n    private static long gcd(long a, long b){\n        while (b != 0) {\n            long rem = a % b;\n            a = b;\n            b = rem;\n        }\n        return a;\n    }\n}\n```
['Java']