C++ HashMap dp Solution
\nclass Solution {\npublic:\n    int numFactoredBinaryTrees(vector<int>& arr) {\n        int n= arr.size();\n        vector<long long> dp(n,1);\n        int mod
```\nclass Solution {\npublic:\n    int numFactoredBinaryTrees(vector<int>& arr) {\n        int n= arr.size();\n        vector<long long> dp(n,1);\n        int mod= 1e9+7;\n        \n        sort(arr.begin(),arr.end());\n        \n        //element --> index\n        unordered_map<int,int> mp;\n        \n        for(int i=0;i<n; i++)\n            mp[arr[i]] = i;\n        \n        for(int i=0; i<n; i++) {\n            for(int j=0; j<i; j++) {\n                if(arr[i]%arr[j]==0) {\n                    int quo = arr[i]/arr[j];\n                    if(mp.count(quo)) {\n                        dp[i] += dp[j] * dp[mp[quo]];\n                    }\n                }\n            }\n        }\n        \n        long long result = 0;\n        for(auto &ele : dp) {\n            result += ele;\n        }\n        \n        return result%mod;\n    }\n};\n```
['Dynamic Programming', 'C', 'C++']