Simple C solution
\nint cmp(const void *a, const void *b)\n{\n    return *(int *)a - *(int *)b;\n}\n\nint numFactoredBinaryTrees(int* arr, int arrSize){\n    int result = 0, mod 
```\nint cmp(const void *a, const void *b)\n{\n    return *(int *)a - *(int *)b;\n}\n\nint numFactoredBinaryTrees(int* arr, int arrSize){\n    int result = 0, mod = pow(10, 9) + 7;\n    qsort(arr, arrSize, sizeof(int), cmp);\n    long dp[arrSize];\n    for(int i = 0; i < arrSize; i++) \n        dp[i] = 1;\n    for(int i = 0; i < arrSize; i++) \n    {\n\t\tint left = 0, right = i - 1;\n\t\twhile (left <= right) \n        {\n\t\t\tif((long)arr[left] * arr[right] > arr[i])\n\t\t\t\tright--;\n\t\t\telse if ((long)arr[left] * arr[right] < arr[i])\n\t\t\t\tleft++;\n\t\t\telse\n            {\n\t\t\t\tif (left == right)\n\t\t\t\t\tdp[i] += (dp[left] * dp[right]);\n\t\t\t\telse\n\t\t\t\t\tdp[i] += 2 * (dp[left] * dp[right]);\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t}\n\t\t}\n\t\tresult = ((result % mod) + dp[i]) % mod;   \n\t}\n    return result;\n}\n```
['Dynamic Programming', 'C', 'Sorting']