Easiest Simple 5 --  different ways C // C++ // Python3 // Java // Python Beats 100%
Intuition\n\n\n\nC++ []\nclass Solution {\npublic:\n    bool isPossibleToSplit(vector<int>& nums) {\n        unordered_map<int, int> mp;\n        for (auto& x :
# Intuition\n![Screenshot 2024-02-25 100516.png](https://assets.leetcode.com/users/images/afb6c969-ef87-4d6b-be1a-8ade0fb6b44b_1708837290.885332.png)\n![Screenshot 2024-02-25 100235.png](https://assets.leetcode.com/users/images/9e10b0bb-82c8-477a-9ae6-315235e280c3_1708837296.566588.png)\n![Screenshot 2024-02-25 095357.png](https://assets.leetcode.com/users/images/039f70d1-d519-41ec-8ec7-cb86649634cc_1708837301.7219656.png)\n```C++ []\nclass Solution {\npublic:\n    bool isPossibleToSplit(vector<int>& nums) {\n        unordered_map<int, int> mp;\n        for (auto& x : nums)\n            mp[x]++;\n        for (auto& pr : mp) {\n            if (pr.second > 2)\n                return false;\n        }\n        return true;\n    }\n};\n```\n```python3 []\nclass Solution:\n    def isPossibleToSplit(self, nums: List[int]) -> bool:\n        map = {}\n        for num in nums:\n            map[num] = map.get(num, 0) + 1\n\n        for cnt in map.values():\n            if cnt > 2:\n                return False\n        return True\n```\n```C []\nbool isPossibleToSplit(int* nums, int numsSize) {\n    int* arr = (int*)malloc(sizeof(int) * 101);\n    for (int i = 0; i < 101; ++i)\n        arr[i] = 0;\n    for (int i = 0; i < numsSize; ++i) {\n        arr[nums[i]]++;\n        if (arr[nums[i]] > 2)\n            return false;\n    }\n    return true;\n}\n```\n```Java []\nclass Solution {\n    public boolean isPossibleToSplit(int[] nums) {\n        Arrays.sort(nums);\n        for (int i = 2; i < nums.length; ++i) {\n            if (nums[i] == nums[i - 2])\n                return false;\n        }\n        return true;\n    }\n}\n```\n```python []\nclass Solution(object):\n    def isPossibleToSplit(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: bool\n        """\n        ele_freq = [0] * 101\n\n        for num in nums:\n            ele_freq[num] += 1\n            if ele_freq[num] > 2:\n                return False\n        \n        return True\n```\n\n\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(1)\n# Code\n```\nclass Solution:\n    def isPossibleToSplit(self, nums: List[int]) -> bool:\n        map = {}\n        for num in nums:\n            map[num] = map.get(num, 0) + 1\n\n        for cnt in map.values():\n            if cnt > 2:\n                return False\n        return True\n\n```
['Array', 'Hash Table', 'C', 'Python', 'C++', 'Java', 'Python3']