C++ || DP || MAP
```\nclass Solution {\npublic:\n    int numFactoredBinaryTrees(vector& arr) {\n         sort(arr.begin(),arr.end());\n         int mod = 1e9 + 7;\n        map m
```\nclass Solution {\npublic:\n    int numFactoredBinaryTrees(vector<int>& arr) {\n         sort(arr.begin(),arr.end());\n         int mod = 1e9 + 7;\n        map<int, long long> mp;\n        \n        for(int i=0; i<arr.size(); i++){\n              mp[arr[i]] = 1;\n            for(int j=0; j<i; j++){\n                if(arr[i] % arr[j] == 0){\n                    mp[arr[i]] += (long long)(mp[arr[j]] * mp[arr[i] / arr[j]]) % mod;\n                    mp[arr[i]] %= mod;\n                }\n            }\n        }\n          long long ans = 0;\n        \n        for(auto it = mp.begin(); it!=mp.end(); it++){\n             ans= (ans + it->second)  % mod;\n        }\n           return ans;\n        \n    }\n};
['Dynamic Programming', 'C']