Best Solution || Easy to Understand
\n# Code\ncpp []\n#define ll long long\n// here we are normally calculating gcd and lcm after removing every element as the contraints are not high.\nclass Solu
\n# Code\n```cpp []\n#define ll long long\n// here we are normally calculating gcd and lcm after removing every element as the contraints are not high.\nclass Solution {\npublic:\n    ll gcd(ll a,ll b){\n        if(b==0) return a;\n        return gcd(b,a%b);\n    }\n\n    ll lcm(ll a,ll b)\n    {\n        return a*b/gcd(a,b);\n    }\n    long long maxScore(vector<int>& nums) \n    {\n        ll n = nums.size();\n        ll ans = INT_MIN;\n        for(ll i=0 ; i<=n ; i++)\n        {\n            ll gcdd=0,lcmm=1;\n            for(ll j=0 ;j <n ; j++)\n            {\n               if(i!=j)\n               {\n                 gcdd = gcd(nums[j],gcdd);\n                 lcmm = lcm(nums[j],lcmm);\n               }\n            }\n            ans = max(ans,gcdd*lcmm);\n        }\n        return ans;\n    }\n};\n```
['Array', 'Math', 'C++']