#3151

Special Array I

easy · 81.6% accepted · 581 likes · top 93%

array

⊣ practice⊣ open on leetcode ↗

Description

An array is considered special if the parity of every pair of adjacent elements is different. In other words, one element in each pair must be even, and the other must be odd.

You are given an array of integers nums. Return true if nums is a special array, otherwise, return false.

Solution