✅✔️Easy implementation using sorting and Map || C++ Solution ✈️✈️✈️✈️✈️
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int numFactoredBinaryTrees(vector<int>& arr) {\n        int n = arr.size(), mod = 1e9+7;\n        sort(arr.begin(),arr.end());\n        map<int,int>idx;\n        map<int,long long>mp;\n        for(int i=0; i<n; i++){\n            idx[arr[i]] = i;\n            mp[i] = 1;\n        }\n        for(int i=1; i<n; i++){\n            for(int j=0; j<i; j++){\n                if(arr[i] % arr[j] == 0 && idx.find(arr[i]/arr[j]) != idx.end()){\n                    mp[i] += (mp[j] * mp[idx[arr[i]/arr[j]]]);\n                    mp[i] = mp[i]%mod;\n                }\n            }\n        }\n\n        long long ans = 0;\n        for(auto i : mp){\n            ans += i.second;\n            ans %= mod;\n        }\n        return ans%mod;\n    }\n};\n```
['Hash Table', 'Dynamic Programming', 'Sorting', 'C++']