CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes561downloads
meta.json284 linesDownload Raw Back to special_array_i
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 00:00:00",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    "public_test_cases": [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    "private_test_cases": [26        {27            "input": [28                46,29                83,30                12,31                71,32                62,33                39,34                54,35                19,36                88,37                95,38                72,39                95,40                6,41                85,42                16,43                33,44                22,45                33,46                42,47                7,48                50,49                7,50                50,51                17,52                34,53                53,54                32,55                49,56                62,57                13,58                2,59                77,60                10,61                1362            ],63            "output": true64        },65        {66            "input": [67                52,68                45,69                36,70                81,71                80,72                39,73                46,74                19,75                38,76                59,77                14,78                5,79                96,80                59,81                62,82                35,83                42,84                89,85                88,86                91,87                56,88                73,89                490            ],91            "output": true92        },93        {94            "input": [95                78,96                61,97                30,98                7,99                6,100                99,101                12,102                31,103                100,104                11,105                12,106                29,107                90,108                51,109                68110            ],111            "output": true112        },113        {114            "input": [115                10,116                51,117                68,118                35,119                64,120                33,121                4,122                17,123                18,124                71,125                78,126                79,127                40,128                91,129                70,130                37,131                46,132                59,133                100,134                55,135                96,136                41,137                22,138                27,139                94,140                49,141                14,142                71,143                70,144                9,145                12,146                21,147                50,148                95,149                60,150                7,151                2,152                7,153                58,154                23,155                96,156                25,157                62,158                73,159                12,160                47,161                78,162                53,163                16,164                79,165                62,166                13,167                70,168                35,169                62,170                7,171                10,172                79,173                12,174                25,175                28,176                3,177                78,178                41,179                54,180                89,181                90,182                43,183                20,184                85,185                8,186                41,187                68,188                81,189                14,190                69,191                100,192                23,193                36,194                39,195                90,196                17,197                64,198                11,199                82,200                91,201                50202            ],203            "output": true204        },205        {206            "input": [207                32,208                45,209                8,210                79,211                60,212                17,213                62,214                71,215                36,216                95,217                72,218                57,219                48,220                49,221                8,222                81,223                86,224                65,225                74,226                35,227                94,228                23,229                26,230                37,231                74,232                67,233                4,234                37,235                58,236                71,237                80,238                45,239                64,240                7,241                98,242                95,243                98,244                35,245                36,246                25,247                74,248                57,249                64,250                13,251                22,252                71,253                80,254                17,255                90,256                41,257                42,258                23,259                70,260                81,261                74,262                13,263                84,264                71,265                54,266                9,267                90,268                39,269                100,270                81,271                70,272                31,273                44,274                15275            ],276            "output": true277        }278    ],279    "haskell_template": "isArraySpecial :: [Int] -> Bool\nisArraySpecial nums ",280    "ocaml_template": "let isArraySpecial (nums: int list) : bool =  ",281    "scala_template": "def isArraySpecial(nums: List[Int]): Boolean = { \n    \n}",282    "java_template": "class Solution {\n    public boolean isArraySpecial(int[] nums) {\n        \n    }\n}",283    "python_template": "class Solution(object):\n    def isArraySpecial(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: bool\n        \"\"\"\n        "284}