Skip to content

Commit 5170e95

Browse files
committed
Added README.md file for Special Array I
1 parent 0adbcb3 commit 5170e95

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

3429-special-array-i/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<h2><a href="https://leetcode.com/problems/special-array-i">Special Array I</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>An array is considered <strong>special</strong> if every pair of its adjacent elements contains two numbers with different parity.<!-- notionvc: e6bed0fa-c67d-43a7-81b4-99fb85b99e98 --></p>
2+
3+
<p>You are given an array of integers <code>nums</code>. Return <code>true</code> if <code>nums</code> is a <strong>special</strong> array, otherwise, return <code>false</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<div class="example-block">
9+
<p><strong>Input:</strong> <span class="example-io">nums = [1]</span></p>
10+
11+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
12+
13+
<p><strong>Explanation:</strong></p>
14+
15+
<p>There is only one element. So the answer is <code>true</code>.</p>
16+
</div>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<div class="example-block">
21+
<p><strong>Input:</strong> <span class="example-io">nums = [2,1,4]</span></p>
22+
23+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
24+
25+
<p><strong>Explanation:</strong></p>
26+
27+
<p>There is only two pairs: <code>(2,1)</code> and <code>(1,4)</code>, and both of them contain numbers with different parity. So the answer is <code>true</code>.</p>
28+
</div>
29+
30+
<p><strong class="example">Example 3:</strong></p>
31+
32+
<div class="example-block">
33+
<p><strong>Input:</strong> <span class="example-io">nums = [4,3,1,6]</span></p>
34+
35+
<p><strong>Output:</strong> <span class="example-io">false</span></p>
36+
37+
<p><strong>Explanation:</strong></p>
38+
39+
<p><code>nums[1]</code> and <code>nums[2]</code> are both odd. So the answer is <code>false</code>.</p>
40+
</div>
41+
42+
<p>&nbsp;</p>
43+
<p><strong>Constraints:</strong></p>
44+
45+
<ul>
46+
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
47+
<li><code>1 &lt;= nums[i] &lt;= 100</code></li>
48+
</ul>

0 commit comments

Comments
 (0)