#3334

Find the Maximum Factor Score of Array

medium · 41% accepted · 86 likes · top 21%

array · math · number theory

⊣ practice⊣ open on leetcode ↗

Description

You are given an integer array nums.

The factor score of an array is defined as the product of the LCM and GCD of all elements of that array.

Return the maximum factor score of nums after removing at most one element from it.

Note that both the LCM and GCD of a single number are the number itself, and the factor score of an empty array is 0.

Solution