Easy to understand C++ code
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 HCF(vector<int>& nums)\n    {\n        int l = nums.size();\n        long long num2 = nums[l-1];\n        for(int i = l-2; i>=0; i--)\n        {\n            long long num1 = nums[i];\n            \n            long long hcf;\n            long long temp = num1;\n            if(num1>num2)\n            {\n                num1 = num2;\n                num2 = temp;\n            }\n            // long long newnum1 = num1, newnum2 = num2;\n            // while(newnum1!=0 && newnum2%newnum1!=0)\n            // {\n            //     newnum1 = newnum2%newnum1;\n            //     newnum2 = num1;\n            //     num1 = newnum1;\n            // }\n            num2 = gcd(num1, num2);\n            // hcf = newnum1;\n        }\n        return num2;\n    }\n\n    long long LCM(vector<int>& nums)\n    {\n        int l = nums.size();\n        long long num2 = nums[l-1];\n        for(int i = l-2; i>=0; i--)\n        {\n            long long num1 = nums[i];\n            \n            long long lcm = (num1*num2)/(gcd(num1, num2));\n            // for(lcm = max(num1, num2); lcm<=num1*num2; lcm++)\n            // {\n            //     if(lcm%num1==0 && lcm%num2==0)\n            //     {\n            //         num2 = lcm;\n            //         break;\n            //     }\n            // }\n            num2 = lcm;\n        }\n        return num2;\n    }\n    long long maxScore(vector<int>& nums) {\n        int l = nums.size();\n        long long lcm, hcf;\n        long long ans = 0;\n        if(nums.size()==1)\n        return nums[0]*nums[0];\n        for(int i = -1; i<l; i++)\n        {\n            int notaken = 0;\n            if(i>=0){ \n            notaken = nums[i];\n            nums.erase(nums.begin()+i);\n            }\n            long long prod = LCM(nums)*HCF(nums);\n            ans = max(ans, prod);\n            if(i>=0)\n            nums.insert(nums.begin()+i, notaken);\n        }\n        return ans;\n    }\n};\n```
['C++']