Simple java solution
Intuition\n Describe your first thoughts on how to solve this problem. \nThe intuition behind the solution provided is to sort the array nums. After sorting, if
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe intuition behind the solution provided is to sort the array nums. After sorting, if there exists any element in the sorted array such that it is equal to the element two positions ahead of it (nums[i] == nums[i+2]), then it\'s not possible to split the array as required. This is because if such a pair exists, it means there are at least two identical elements within any three consecutive elements in the sorted array, making it impossible to separate them into two distinct groups without having elements from one group equal to elements from the other group.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1) Sorting: Sort the array nums. Sorting helps in easily identifying consecutive elements.\n2) Checking Consecutive Triplets: Iterate through the sorted array and check if nums[i] is equal to nums[i+2]. If such a condition is found, return false immediately because the array cannot be split as required.\n3) Return True: If no such consecutive triplet is found where nums[i] == nums[i+2], return true, indicating it is possible to split the array as required.\n\n# Complexity\n- Time complexity:O(n log n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public boolean isPossibleToSplit(int[] nums) {\n        int n=nums.length;\n        Arrays.sort(nums);\n        for(int i=0;i<n-2;i++){\n            if(nums[i]==nums[i+2]) return false;\n        }\n        return true;\n    }\n}\n```
['Java']