Brute Force
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```cpp []\n\n\nclass Solution {\npublic:\n    long long gcd(long long a, long long b)\n    {\n        if(b>a)\n            swap(a,b);\n        if(b==0)\n            return a;\n        return gcd(a%b, b);\n        \n    }\n    long long calculate_max_factor(vector<int>& arr, int idx)\n    {\n        long long lcm = arr[0];\n        long long hcf = arr[0];\n        long long gc = arr[0];\n        int n = arr.size();\n        if(idx == 0)\n        {\n            lcm = arr[1];\n            hcf = arr[1];\n            gc = arr[1];\n        }\n        for(int i=0;i<n;i++)\n        {\n            if(i == idx)\n                continue;\n            hcf = gcd(lcm, arr[i]);\n            lcm = (lcm * arr[i])/hcf;\n            gc = gcd(gc, arr[i]);\n        }\n        return lcm * gc;\n    }\n    long long maxScore(vector<int>& arr) {\n        int n = arr.size();\n        if(n==1)\n            return 1LL * arr[0] * arr[0];\n        long long ans = 0;\n        ans = calculate_max_factor(arr, -1);\n        for(int i=0;i<n;i++)\n        {\n            ans = max(ans, calculate_max_factor(arr, i));\n        }\n        return ans;\n    }\n};\n```
['C++']