Why is sorting required here
Why do so many solutions use sorting here? My code works fine without sorting. Whats the need for sorting at all?\n\nclass Solution:\n    def numFactoredBinaryT
Why do so many solutions use sorting here? My code works fine without sorting. Whats the need for sorting at all?\n```\nclass Solution:\n    def numFactoredBinaryTrees(self, arr: List[int]) -> int:\n        \n        \n        MOD = 10**9+7\n        nodes = set(arr)\n        \n        @lru_cache(None)\n        def rootTree(rootVal):\n            \n            count = 1\n            for left in nodes:\n                if rootVal%left == 0:\n                    right = rootVal // left\n                    if right in nodes:\n                        count += rootTree(left)*rootTree(right)\n                        \n            return count\n        \n        \n        count = 0\n        for x in arr:\n            count+=rootTree(x)\n            \n        return count % MOD\n            \n```
[]