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)/检查「好数组」 [check-if-it-is-a-good-array].html
2022-03-29 12:43:11 +08:00

37 lines
1.0 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>,你需要从中任选一些子集,然后将子集中每一个数乘以一个 <strong>任意整数</strong>,并求出他们的和。</p>
<p>假如该和结果为&nbsp;<code>1</code>,那么原数组就是一个「<strong>好数组</strong>」,则返回 <code>True</code>;否则请返回 <code>False</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>nums = [12,5,7,23]
<strong>输出:</strong>true
<strong>解释:</strong>挑选数字 5 和 7。
5*3 + 7*(-2) = 1
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>nums = [29,6,10]
<strong>输出:</strong>true
<strong>解释:</strong>挑选数字 29, 6 和 10。
29*1 + 6*(-3) + 10*(-1) = 1
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>nums = [3,6]
<strong>输出:</strong>false
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 10^5</code></li>
<li><code>1 &lt;= nums[i] &lt;= 10^9</code></li>
</ul>