[C] prefix & suffix | Time: O(n), Space: O(n)
C []\nstatic int gcd(int a, int b){\n\twhile (b != 0){\n\t\tconst int c = a % b;\n\n\t\ta = b;\n\t\tb = c;\n\t}\n\n\treturn a;\n}\n\nstatic int64_t gcd_int64(in
```C []\nstatic int gcd(int a, int b){\n\twhile (b != 0){\n\t\tconst int c = a % b;\n\n\t\ta = b;\n\t\tb = c;\n\t}\n\n\treturn a;\n}\n\nstatic int64_t gcd_int64(int64_t a, int64_t b){\n\twhile (b != 0){\n\t\tconst int64_t c = a % b;\n\n\t\ta = b;\n\t\tb = c;\n\t}\n\n\treturn a;\n}\nstatic int64_t lcm_int64(const int64_t a, const int64_t b){\n\treturn a / gcd_int64(a, b) * b;\n}\n\nint64_t maxScore(const int * const nums, const int numsLen){\n\tif (0 == numsLen){\n\t\treturn 0;\n\t}\n\tassert(numsLen >= 1);\n\n\ttypedef struct LcmGcd{\n\t\tint64_t lcm;\n\t\tint gcd;\n\t} LcmGcd;\n\n\tLcmGcd prefixs[numsLen];\n\tprefixs[0].lcm = 1;\n\tprefixs[0].gcd = 0;\n\tfor (int i = 1; i < numsLen; i += 1){\n\t\tprefixs[i].lcm = lcm_int64(prefixs[i - 1].lcm, nums[i - 1]);\n\t\tprefixs[i].gcd = gcd(prefixs[i - 1].gcd, nums[i - 1]);\n\t}\n\n\tLcmGcd suffixs[numsLen];\n\tsuffixs[numsLen - 1].lcm = 1;\n\tsuffixs[numsLen - 1].gcd = 0;\n\tfor (int i = numsLen - 2; i >= 0; i -= 1){\n\t\tsuffixs[i].lcm = lcm_int64(suffixs[i + 1].lcm, nums[i + 1]);\n\t\tsuffixs[i].gcd = gcd(suffixs[i + 1].gcd, nums[i + 1]);\n\t}\n\n\tint64_t maxFactorScore = lcm_int64(prefixs[numsLen - 1].lcm, nums[numsLen - 1]) *\n\t\tgcd(prefixs[numsLen - 1].gcd, nums[numsLen - 1]); //remove nothing\n\tfor (int i = 0; i < numsLen; i += 1){\n\t\tconst int64_t curFactorScore = lcm_int64(prefixs[i].lcm, suffixs[i].lcm) *\n\t\t\tgcd(prefixs[i].gcd, suffixs[i].gcd);\n\t\tif (curFactorScore > maxFactorScore){\n\t\t\tmaxFactorScore = curFactorScore;\n\t\t}\n\t}\n\treturn maxFactorScore;\n}\n```
['C']