Easy to understand c++ soln with separate function for each task. Beats 100%.
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nCalculating lcm and gcd for nums array and then trying all possible array
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nCalculating lcm and gcd for nums array and then trying all possible arrays by removing one element from nums and calculating product of  gcd and lcm for each of them and storing the maximum of all.\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 []\nclass Solution {\npublic:\nlong long gcd(long long a, long long b){\n    while(a > 0 && b > 0){\n        if(a > b){\n            a = a % b;\n        }\n        else{\n            b = b % a;\n        }\n    }\n    if( a == 0)\n    return b;\n    return a;\n}\nlong long findlcm(vector<int> & nums){\n    int n = nums.size();\n    long long ans = nums[0];\n    for(int i =1; i<n; i++){\n        ans = (ans * 1ll * nums[i])/(gcd(ans, nums[i]));\n    }\n    return ans;\n}\nlong long findgcd(vector<int>& nums){\n    int n = nums.size();\n    long long ans = nums[0];\n    for(int i = 1; i<n; i++){\n        ans = gcd(ans, nums[i]);\n    }\n    return ans;\n}\n    long long maxScore(vector<int>& nums) {\n        int n = nums.size();\n        long long lcm1 = findlcm(nums);\n        long long gcd1 = findgcd(nums);\n        long long maxi = lcm1 * 1ll * gcd1;\n        long long lcm2 = 0, gcd2 = 0;\n        vector<int> nums2;\n        if(n > 1){\n            for(int i = 0; i<n; i++){\n                nums2 = nums;\n                nums2.erase(nums2.begin() + i);\n                lcm2 = findlcm(nums2);\n                gcd2 = findgcd(nums2);\n                maxi = max(maxi, lcm2 * 1ll * gcd2);\n            }\n        }\n        return maxi;\n    }\n};\n```
['Array', 'C++']