C# Short and simple
Intuition\n\nCheck all cases of which number if any is excluded. Compute the factor score in each case.\n\nexclude = -1 means no number is excluded.\n\nlcm is i
# Intuition\n\nCheck all cases of which number if any is excluded. Compute the factor score in each case.\n\n`exclude = -1` means no number is excluded.\n\n`lcm` is initialised to 1 because $LCM(1, x) = x$ for all $x$\n\n`gcd` is initialised to 0 because $GCD(0, x) = x$ for all $x$\n\n\n# Complexity\n- Time complexity: $O(n^2)$ \n\n- Space complexity: $O(1)$\n\n# Code\n```csharp []\npublic class Solution {\n    public long MaxScore(int[] nums) {\n        int n = nums.Length;\n        long result = 0;\n        for (int exclude = -1; exclude < n; exclude++)\n        {\n            long lcm = 1;\n            long gcd = 0;\n            for (int i = 0; i < n; i++)\n            {\n                if (i == exclude)\n                {\n                    continue;\n                }\n                lcm = LCM(lcm, nums[i]);\n                gcd = GCD(gcd, nums[i]);\n            }\n            result = Math.Max(result, lcm * gcd);\n        }\n        return result;\n    }\n\n    public long GCD(long x, long y)\n    {\n        while (x > 0 && y > 0)\n        {\n            if (x > y)\n            {\n                x %= y;\n            }\n            else\n            {\n                y %= x;\n            }\n        }\n        return x | y;\n    }\n\n    public long LCM(long x, long y)\n    {\n        return x * y / GCD(x, y);\n    }\n}\n```
['Number Theory', 'C#']