👏Beats 98.75% of users with Java || Simple & Easy Array Approach 🔥💥
Intuition\nmake a array variable cnt and count the frequency of every element if any element\'s frequency is go to more than 2 simply return false.\n\n\n# I thi
# Intuition\nmake a array variable cnt and count the frequency of every element if any element\'s frequency is go to more than 2 simply return false.\n\n\n# **I think This can Help you**\n![Screenshot 2024-03-01 105912.png](https://assets.leetcode.com/users/images/127bdd8a-9d01-4433-a138-88881addbf4a_1709278821.8457968.png)\n\n# Approach\n1. make array variable as a cnt for storing frequency of every element.\n2. iterate over the array and add frequency in the cnt array variable & check if frequency is more than 2 then return false.\n3. if loop is finished & no one element has a frequency more than 2 then return true.\n\n# Complexity\n- Time complexity:\nO(n)   --> iterating loop over the array.\n\n- Space complexity:\nO(n)  --> for make array variable as cnt.\n\n# Code\n```\nclass Solution {\n    public boolean isPossibleToSplit(int[] nums) {\n        int[] cnt = new int[101];  // make array variable as a cnt for storing frequency of every element.\n        for(int i=0;i<nums.length;i++){   // iterate over the array and add frequency in the cnt array variable & check if frequency is more than 2 then return false.\n            cnt[nums[i]-1]++;\n            if(cnt[nums[i]-1]>2){\n                return false;\n            }\n        }\n        return true;   // if loop is finished & no one element has a frequency more than 2 then return true.\n    }\n}\n```\n\n![_4613fad8-dfaf-49b7-a06e-3a0dd6756db2.jpeg](https://assets.leetcode.com/users/images/9a667935-82f8-4304-891e-1b312bfc4757_1709278668.943773.jpeg)\n\n
['Array', 'Counting', 'Java']