{ "id": 3429, "name": "special_array_i", "difficulty": "Easy", "link": "https://leetcode.com/problems/special-array-i/", "date": "2024-05-12 00:00:00", "task_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`. **Example 1:** **Input:** nums = [1] **Output:** true **Explanation:** There is only one element. So the answer is `true`. **Example 2:** **Input:** nums = [2,1,4] **Output:** true **Explanation:** There is only two pairs: `(2,1)` and `(1,4)`, and both of them contain numbers with different parity. So the answer is `true`. **Example 3:** **Input:** nums = [4,3,1,6] **Output:** false **Explanation:** `nums[1]` and `nums[2]` are both odd. So the answer is `false`. **Constraints:** `1 <= nums.length <= 100` `1 <= nums[i] <= 100`", "public_test_cases": [ { "label": "Example 1", "input": "nums = [1]", "output": "true " }, { "label": "Example 2", "input": "nums = [2,1,4]", "output": "true " }, { "label": "Example 3", "input": "nums = [4,3,1,6]", "output": "false " } ], "private_test_cases": [ { "input": [ 46, 83, 12, 71, 62, 39, 54, 19, 88, 95, 72, 95, 6, 85, 16, 33, 22, 33, 42, 7, 50, 7, 50, 17, 34, 53, 32, 49, 62, 13, 2, 77, 10, 13 ], "output": true }, { "input": [ 52, 45, 36, 81, 80, 39, 46, 19, 38, 59, 14, 5, 96, 59, 62, 35, 42, 89, 88, 91, 56, 73, 4 ], "output": true }, { "input": [ 78, 61, 30, 7, 6, 99, 12, 31, 100, 11, 12, 29, 90, 51, 68 ], "output": true }, { "input": [ 10, 51, 68, 35, 64, 33, 4, 17, 18, 71, 78, 79, 40, 91, 70, 37, 46, 59, 100, 55, 96, 41, 22, 27, 94, 49, 14, 71, 70, 9, 12, 21, 50, 95, 60, 7, 2, 7, 58, 23, 96, 25, 62, 73, 12, 47, 78, 53, 16, 79, 62, 13, 70, 35, 62, 7, 10, 79, 12, 25, 28, 3, 78, 41, 54, 89, 90, 43, 20, 85, 8, 41, 68, 81, 14, 69, 100, 23, 36, 39, 90, 17, 64, 11, 82, 91, 50 ], "output": true }, { "input": [ 32, 45, 8, 79, 60, 17, 62, 71, 36, 95, 72, 57, 48, 49, 8, 81, 86, 65, 74, 35, 94, 23, 26, 37, 74, 67, 4, 37, 58, 71, 80, 45, 64, 7, 98, 95, 98, 35, 36, 25, 74, 57, 64, 13, 22, 71, 80, 17, 90, 41, 42, 23, 70, 81, 74, 13, 84, 71, 54, 9, 90, 39, 100, 81, 70, 31, 44, 15 ], "output": true } ], "haskell_template": "isArraySpecial :: [Int] -> Bool\nisArraySpecial nums ", "ocaml_template": "let isArraySpecial (nums: int list) : bool = ", "scala_template": "def isArraySpecial(nums: List[Int]): Boolean = { \n \n}", "java_template": "class Solution {\n public boolean isArraySpecial(int[] nums) {\n \n }\n}", "python_template": "class Solution(object):\n def isArraySpecial(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: bool\n \"\"\"\n " }