1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/数组的最大因子得分 [find-the-maximum-factor-score-of-array].html
2024-11-07 00:20:26 +08:00

51 lines
1.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个整数数组 <code>nums</code></p>
<p><strong>因子得分 </strong>定义为数组所有元素的最小公倍数LCM与最大公约数GCD<strong> 乘积</strong></p>
<p><strong>最多</strong> 移除一个元素的情况下,返回 <code>nums</code><strong> 最大因子得分</strong></p>
<p><strong>注意</strong>,单个数字的 <span data-keyword="lcm-function">LCM</span><span data-keyword="gcd-function">GCD</span> 都是其本身,而<strong> </strong><strong>空数组</strong> 的因子得分为 0。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">nums = [2,4,8,16]</span></p>
<p><strong>输出:</strong> <span class="example-io">64</span></p>
<p><strong>解释:</strong></p>
<p>移除数字 2 后,剩余元素的 GCD 为 4LCM 为 16因此最大因子得分为 <code>4 * 16 = 64</code></p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">nums = [1,2,3,4,5]</span></p>
<p><strong>输出:</strong> <span class="example-io">60</span></p>
<p><strong>解释:</strong></p>
<p>无需移除任何元素即可获得最大因子得分 60。</p>
</div>
<p><strong class="example">示例 3</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">nums = [3]</span></p>
<p><strong>输出:</strong> 9</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
<li><code>1 &lt;= nums[i] &lt;= 30</code></li>
</ul>