FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 3429,3 "name": "special-array-i",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/special-array-i/",6 "date": "2024-05-12",7 "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`",8 "test_case": [9 {10 "label": "Example 1",11 "input": "nums = [1]",12 "output": "true "13 },14 {15 "label": "Example 2",16 "input": "nums = [2,1,4]",17 "output": "true "18 },19 {20 "label": "Example 3",21 "input": "nums = [4,3,1,6]",22 "output": "false "23 }24 ],25 "constraints": [26 "1 <= nums.length <= 100",27 "1 <= nums[i] <= 100"28 ],29 "python_template": "class Solution(object):\n def isArraySpecial(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: bool\n \"\"\"\n ",30 "java_template": "class Solution {\n public boolean isArraySpecial(int[] nums) {\n \n }\n}",31 "metadata": {32 "func_name": "isArraySpecial"33 }34}