JAVA || Easy Solution Using HashMap
\tPLEASE UPVOTE IF YOU LIKE\n\nclass Solution {\n    public int numFactoredBinaryTrees(int[] arr) {\n        Arrays.sort(arr);\n        HashMap<Integer,Long>map
\tPLEASE UPVOTE IF YOU LIKE\n```\nclass Solution {\n    public int numFactoredBinaryTrees(int[] arr) {\n        Arrays.sort(arr);\n        HashMap<Integer,Long>map=new HashMap<Integer,Long>();\n        long ans=1;\n        map.put(arr[0],ans);\n        for(int i=1;i<arr.length;i++)\n        {\n            long sum=1;\n            for(int j=0;j<i;j++)\n            {\n                if(arr[i]%arr[j]==0 && map.containsKey(arr[i]/arr[j]))\n                    sum=sum+(map.get(arr[i]/arr[j])*map.get(arr[j]));\n            }\n            map.put(arr[i],sum);\n            ans=ans+sum;\n        }\n        return (int)(ans%1000000007);\n    }\n}\n```
['Java']