Python DP solution
\nclass Solution:\n    def largestDivisibleSubset(self, nums: List[int]) -> List[int]:\n        n = len(nums)\n        nums.sort()\n        res = [[num] for num
```\nclass Solution:\n    def largestDivisibleSubset(self, nums: List[int]) -> List[int]:\n        n = len(nums)\n        nums.sort()\n        res = [[num] for num in nums]  #contains sets starting with that number\n        \n        for i in range(n):\n            for j in range(i):\n                if (nums[i] % nums[j]) == 0 and len(res[i]) < len(res[j]) + 1:  #to ensure the length of the set is maximal \n                    res[i] = res[j] + [nums[i]]\n                    \n        return max(res, key=len)  #return max length set\n  \n```
['Dynamic Programming', 'Python', 'Python3']