Day-4
IntuitionEach number in nums should appear at most twice total(Once for the first array,Once for the second array).If any number appears 3 times or more, it's i
# Intuition
Each number in nums should appear at most twice total(Once for the first array,Once for the second array).If any number appears 3 times or more, it's impossible to split without duplicates.

# Approach
Using hash map, we count the frequency of each element and if it is greater than 2 then return false else return true.

# Complexity
- Time complexity:O(n)

- Space complexity:O(n)

# Code
```cpp []
#include <map>
class Solution {
public:
    bool isPossibleToSplit(vector<int>& nums) {
         std::unordered_map<int, int> freq;

        for (int num : nums) {
            freq[num]++;
            if (freq[num] > 2) {
                return false; 
            }
        }

        return true;
    }
};
```
['C++']