Beats 100% efficient 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```cpp []\nclass Solution {\npublic:\n    long long gcd(long long a,long long b){\n        if(a==0)return b;\n        return gcd(b%a,a);\n    }\n    long long lcm(unsigned long long  a,unsigned long long b){\n        return (a*b)/gcd(a,b);\n    }\n    long long maxScore(vector<int>& nums) {\n        if(nums.size()==1)return (long long)nums[0]*(long long)nums[0];\n        long long gcd_=nums[0],n= nums.size(),lcm_=nums[0];\n        long long int gds[n],gdsr[n],lcms[n],lcmsr[n];\n        gds[0]=nums[0];\n        gdsr[n-1]= nums[n-1];\n        lcms[0]=nums[0];\n        lcmsr[n-1]=nums[n-1];\n        for(int i=1;i<nums.size();i++){\n            gcd_ = gcd(gcd_,nums[i]);\n            lcm_ = lcm(lcm_,nums[i]);\n            gds[i]=gcd_;\n            lcms[i]=lcm_;\n        }\n        gcd_=nums[n-1];\n        lcm_=nums[n-1];\n        for(int i=n-2;i>=0;i--){\n            gcd_ = gcd(gcd_,nums[i]);\n            lcm_ = lcm(lcm_,nums[i]);\n            gdsr[i]=gcd_;\n            lcmsr[i]=lcm_;\n        }\n        long long  ans = gcd_*lcm_;\n        for(int i=1;i<n-1;i++){\n            gcd_=gcd(gds[i-1],gdsr[i+1]);\n            lcm_=lcm(lcms[i-1],lcmsr[i+1]);\n            long long temp =gcd_*lcm_;\n            ans = max(ans,temp);\n        }\n        ans = max(ans,gdsr[1]*lcmsr[1]);\n        ans = max(ans,gds[n-2]*lcms[n-2]);\n        \n        \n        return ans;\n    }\n};\n```
['C++']