TheRealSamuel/LeetCodeProblem
0564
1{2 "id": 3324,3 "name": "split_the_array",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/split-the-array/",6 "date": "2024-02-18 00:00:00",7 "task_description": "You are given an integer array `nums` of **even** length. You have to split the array into two parts `nums1` and `nums2` such that: `nums1.length == nums2.length == nums.length / 2`. `nums1` should contain **distinct **elements. `nums2` should also contain **distinct** elements. Return `true`_ if it is possible to split the array, and _`false` _otherwise__._ **Example 1:** ``` **Input:** nums = [1,1,2,2,3,4] **Output:** true **Explanation:** One of the possible ways to split nums is nums1 = [1,2,3] and nums2 = [1,2,4]. ``` **Example 2:** ``` **Input:** nums = [1,1,1,1] **Output:** false **Explanation:** The only possible way to split nums is nums1 = [1,1] and nums2 = [1,1]. Both nums1 and nums2 do not contain distinct elements. Therefore, we return false. ``` **Constraints:** `1 <= nums.length <= 100` `nums.length % 2 == 0 ` `1 <= nums[i] <= 100`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [1,1,2,2,3,4]",12 "output": "true "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,1,1,1]",17 "output": "false "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 79,24 98,25 70,26 52,27 79,28 93,29 39,30 1,31 73,32 8,33 33,34 89,35 99,36 78,37 78,38 4239 ],40 "output": true41 },42 {43 "input": [44 28,45 33,46 20,47 86,48 85,49 55,50 87,51 90,52 18,53 57,54 11,55 11,56 87,57 62,58 23,59 74,60 67,61 22,62 81,63 31,64 1,65 68,66 87,67 26,68 12,69 78,70 66,71 88,72 26,73 3,74 58,75 99,76 14,77 78,78 72,79 6,80 64,81 9882 ],83 "output": false84 },85 {86 "input": [87 100,88 87,89 98,90 2,91 31,92 68,93 54,94 5,95 71,96 39,97 95,98 53,99 90,100 26,101 77,102 13,103 73,104 6,105 89,106 55,107 14,108 18,109 46,110 9,111 66,112 17,113 69,114 89,115 76,116 64,117 49,118 90,119 97,120 58,121 5,122 5,123 9,124 1,125 35,126 76,127 77,128 82,129 49,130 8131 ],132 "output": false133 },134 {135 "input": [136 71,137 63,138 77,139 63,140 91,141 18,142 89,143 39,144 41,145 49,146 64,147 58,148 26,149 99,150 14,151 40,152 69,153 44,154 85,155 58,156 26,157 48,158 92,159 45,160 48,161 77,162 46,163 27,164 21,165 25,166 17,167 10,168 4,169 72,170 43,171 43,172 7,173 48,174 6,175 79,176 34,177 56,178 21,179 1,180 57,181 89,182 78,183 48,184 93,185 49,186 88,187 65,188 12,189 74,190 33,191 9,192 18,193 73,194 53,195 43,196 29,197 3,198 22,199 58,200 25,201 46,202 72,203 86,204 76,205 5,206 85,207 11,208 14,209 14,210 41,211 97,212 9,213 54,214 41,215 53,216 57,217 33,218 43,219 44220 ],221 "output": false222 },223 {224 "input": [225 64,226 53,227 60,228 80,229 73,230 94,231 64,232 27,233 85,234 2,235 67,236 46,237 39,238 55,239 11,240 75,241 96,242 19,243 98,244 40,245 87,246 33,247 51,248 66,249 7,250 72,251 25,252 13,253 89,254 3,255 99,256 15,257 39,258 55,259 38,260 96,261 23,262 83,263 22,264 22,265 48,266 26,267 19,268 33,269 76,270 86,271 56,272 32,273 96,274 23,275 15,276 100,277 49,278 43,279 81,280 38,281 80,282 25,283 43,284 39,285 51,286 43,287 78,288 45,289 54,290 77,291 66,292 75,293 71,294 5,295 47,296 18,297 28,298 86,299 68,300 78,301 71,302 70,303 46,304 12,305 27,306 36,307 23,308 76,309 37,310 77,311 69,312 56,313 3,314 35,315 80,316 40,317 56,318 62,319 51,320 44321 ],322 "output": false323 }324 ],325 "haskell_template": "isPossibleToSplit :: [Int] -> Bool\nisPossibleToSplit nums ",326 "ocaml_template": "let isPossibleToSplit (nums: int list) : bool = ",327 "scala_template": "def isPossibleToSplit(nums: List[Int]): Boolean = { \n \n}",328 "java_template": "class Solution {\n public boolean isPossibleToSplit(int[] nums) {\n \n }\n}",329 "python_template": "class Solution(object):\n def isPossibleToSplit(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: bool\n \"\"\"\n "330}