Short and Easy | No DP | No Recursion | Python
Complexity\n- Time complexity:O(n^2)\n\n- Space complexity:O(n^2)\n\n# Code\n\nclass Solution:\n    def largestDivisibleSubset(self, nums: List[int]) -> List[in
# Complexity\n- Time complexity:O(n^2)\n\n- Space complexity:O(n^2)\n\n# Code\n```\nclass Solution:\n    def largestDivisibleSubset(self, nums: List[int]) -> List[int]:\n        subsets = {-1: set()}\n        \n        for num in sorted(nums):\n            subsets[num] = max([subsets[k] for k in subsets if num % k == 0], key=len) | {num}\n        \n        return list(max(subsets.values(), key=len))\n\n\n\n```
['Hash Table', 'Python', 'Python3']