Easiest and Self Explanatory Solution || Brute Force
\n\n# Code\ncpp []\nclass Solution {\npublic:\n    long long computelcm(long long a, long long b) {\n        return (a * b) / __gcd(a,b);\n    }\n\n\n    long l
\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    long long computelcm(long long a, long long b) {\n        return (a * b) / __gcd(a,b);\n    }\n\n\n    long long maxScore(vector<int>& nums) {\n        long long ans = 0;\n        long long gcd = 0, lcm = 0;\n        int n = nums.size();\n\n        for(int i=0 ; i<n ; i++) {\n            long long overall_gcd = 0;\n            long long overall_lcm = 1;\n\n            for(int j=0 ; j<n ; j++) {\n                overall_gcd = __gcd(overall_gcd, (long long)nums[j]);\n                overall_lcm = computelcm(overall_lcm, (long long)nums[j]);\n            }\n            ans = max(ans, overall_gcd * overall_lcm);\n        }\n\n\n        for(int i=0 ; i<n ; i++) {\n            long long g = 0, l =1;\n            for(int j=0 ; j<n ; j++) {\n                if(i == j) continue;\n                else {\n                    g = __gcd(g, (long long)nums[j]);\n                    l = computelcm(l, (long long)nums[j]);    \n                }\n            }\n            ans = max(ans, g * l);\n\n        }\n\n        return ans;\n    }\n};\n```
['C++']