C++ Easy Solution Using Hashmap Tabulation || DP || Easy understanding
C++ Easy Solution Using Hashmap Tabulation || DP || Easy understanding\nPlease Consider Upvote if you like this Solution Thank You\n\nclass Solution {\npublic:\
# **C++ Easy Solution Using Hashmap Tabulation || DP || Easy understanding**\nPlease Consider *Upvote* if you like this Solution Thank You\n```\nclass Solution {\npublic:\n    int numFactoredBinaryTrees(vector<int>& arr) {\n        \n        int n=arr.size();\n        unordered_map<long long,long long>m;\n        sort(arr.begin(),arr.end());\n        \n        for(int i=0;i<n;i++)\n            m[arr[i]]=1;\n        \n        for(int i=1;i<n;i++){\n            for(int j=i-1;j>=0;j--){\n                int val=arr[i]/arr[j];\n                if(val*arr[j]==arr[i]&&m.count(val)){\n                    m[arr[i]]=m[arr[i]]+(m[val]*m[arr[j]]);\n                    \n                }\n            }\n        }\n        \n        int sum=0;\n        int mod=1e9+7;\n        for(int i=0;i<n;i++)\n            sum=(sum+m[arr[i]])%mod;\n        return sum;\n    }\n};\n```\n
['Dynamic Programming', 'C']