SIMPLE JAVA and PYTHON Solution || Beginner friendly || Without HashMap
Intuition\n Describe your first thoughts on how to solve this problem. \nThis function aims to determine whether it\'s possible to split an array into two non-e
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThis function aims to determine whether it\'s possible to split an array into two non-empty subsets, each having the same sum. Instead of using a dictionary to store the frequency of each number, it uses a list x of size 101, assuming the range of numbers in the input array is from 0 to 100 inclusive. The function checks if any number appears more than twice in the array. If so, it\'s not possible to split the array as required; otherwise, it is possible.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Initialize a list x of size 101, with all elements initialized to 0. This list is used to store the frequency of each number in the input array.\n2. Iterate through the input array.\n3. For each number encountered, increment the corresponding index in the list x by 1.\n4. Check if the count of any number becomes greater than 2 during the iteration. If so, return False, indicating it\'s not possible to split the array as required.\n5. If no number has a count greater than 2, return True, indicating it\'s possible to split the array into two subsets with equal sums.\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1) \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python []\nclass Solution:\n    def isPossibleToSplit(self, nums: List[int]) -> bool:\n        x = [0]*101\n        for num in nums:\n            x[num] += 1\n            if x[num] > 2:\n                return False\n        return True\n```\n```java []\nclass Solution {\n    public boolean isPossibleToSplit(int[] nums) {\n        int new_arr[] = new int[101];\n        \n        for(int i = 0;i<nums.length;i++){\n            new_arr[nums[i]]++;\n            if(new_arr[nums[i]]>2)\n            return false;\n        } \n        return true;\n    }\n}\n```
['Array', 'Java', 'Python3']