Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes194downloads
split-the-array.json33 linesDownload Raw Back to root
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",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  "test_case": [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  "constraints": [21    "nums1.length == nums2.length == nums.length / 2.",22    "nums1 should contain distinct elements.",23    "nums2 should also contain distinct elements.",24    "1 <= nums.length <= 100",25    "nums.length % 2 == 0",26    "1 <= nums[i] <= 100"27  ],28  "python_template": "class Solution(object):\n    def isPossibleToSplit(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: bool\n        \"\"\"\n        ",29  "java_template": "class Solution {\n    public boolean isPossibleToSplit(int[] nums) {\n        \n    }\n}",30  "metadata": {31    "func_name": "isPossibleToSplit"32  }33}