Python Brute Force
\n\n# Complexity\n- Time complexity: O(N**2)\n\n- Space complexity: O(N)\n\n# Code\npython3 []\ndef gcd(a, b):\n    return math.gcd(a, b)\n\ndef lcm(a, b):\n   
\n\n# Complexity\n- Time complexity: O(N**2)\n\n- Space complexity: O(N)\n\n# Code\n```python3 []\ndef gcd(a, b):\n    return math.gcd(a, b)\n\ndef lcm(a, b):\n    return abs(a * b) // gcd(a, b)\n\ndef gcd_of_list(numbers):\n    return reduce(gcd, numbers)\n\ndef lcm_of_list(numbers):\n    return reduce(lcm, numbers)\n\nclass Solution:\n    def maxScore(self, nums: List[int]) -> int:\n        if len(nums) == 1:\n            return nums[0] * nums[0]\n        max_output: int = gcd_of_list(nums) * lcm_of_list(nums)\n        for idx in range(len(nums)):\n            second = nums[:idx] + nums[idx + 1:]\n            max_output = max(max_output, gcd_of_list(second) * lcm_of_list(second))\n        return max_output\n```
['Array', 'Math', 'Number Theory', 'Python3']