An array is special if every pair of adjacent elements has two numbers with different parity, meaning one is odd and the other is even. Given an array of integers nums, return true if nums is special, otherwise return false.
An array is special if every pair of adjacent elements has two numbers with different parity, meaning one is odd and the other is even. Given an array of integers nums, return true if nums is special, otherwise return false.
Example 1:
Input: {"nums":[1]}
Output: true
Constraints:
1≤nums.length≤100
1≤nums[i]≤100
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"nums":[1]}
1 numbers. Special means every neighbouring pair mixes one odd and one even number.