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)/特殊数组 I [special-array-i].html
2024-06-05 08:50:06 +08:00

51 lines
1.6 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>如果数组的每一对相邻元素都是两个奇偶性不同的数字,则该数组被认为是一个 <strong>特殊数组</strong></p>
<p>Aging 有一个整数数组 <code>nums</code>。如果 <code>nums</code> 是一个 <strong>特殊数组</strong> ,返回 <code>true</code>,否则返回 <code>false</code></p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">nums = [1]</span></p>
<p><strong>输出:</strong><span class="example-io">true</span></p>
<p><strong>解释:</strong></p>
<p>只有一个元素,所以答案为 <code>true</code></p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">nums = [2,1,4]</span></p>
<p><strong>输出:</strong><span class="example-io">true</span></p>
<p><strong>解释:</strong></p>
<p>只有两对相邻元素: <code>(2,1)</code><code>(1,4)</code>,它们都包含了奇偶性不同的数字,因此答案为 <code>true</code></p>
</div>
<p><strong class="example">示例 3</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">nums = [4,3,1,6]</span></p>
<p><strong>输出:</strong><span class="example-io">false</span></p>
<p><strong>解释:</strong></p>
<p><code>nums[1]</code><code>nums[2]</code> 都是奇数。因此答案为 <code>false</code></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;= 100</code></li>
</ul>