Python 3 solution using Tree approach (faster than 99%, with comments)
Idea\nGiven a sorted list of numbers, build a tree where each child node value is divisible by its parent node value. Compared to DP, you do not need to process
**Idea**\nGiven a sorted list of numbers, build a tree where each child node value is divisible by its parent node value. Compared to DP, you do not need to process all previous nodes.\n\nFor example:\n```\nnums = [1,2,3,4,5,6,7,8,9,18,20]\n```\nWhen you process 7, you do not check against 4 and 6, since it stops at nodes 2 and 3 that would get to 4 and 6.\nWhen you process 20, you do not check against 9 and 18, since it will stop at nodes 3 and 6, which would get to nodes 9 and 18.\n\n**Implementation**\n```\nclass Node:\n    def __init__(self, val, depth, subset):\n        self.val = val\n        self.depth = depth\n        self.children = []\n        self.subset = subset\n\n\nclass Solution:\n    def largestDivisibleSubset(self, nums: List[int]) -> List[int]:\n        def traverse(node, val):\n            add_child = True\n            for child in node.children:\n                if not val % child.val:\n                    # current value is divisible by value of child node\n                    traverse(child, val)\n                    # if we found a child node, then we do not want to add a node\n                    # since it will have a lower depth\n                    add_child = False\n\t\t\t\t\t\n            if add_child:\n                # add as child to current node since current value is not divisible by any child\n                new_node = Node(val, node.depth + 1, node.subset + [val])\n                node.children.append(new_node)\n\t\t\t\t\n                # check if new node has biggest subset\n                if new_node.depth > max_depth[0]:\n                    max_depth[0] = new_node.depth\n                    max_depth_node[0] = new_node\n\t\t\t\t\t\n\t\t# handle trivial cases of empty input and single value\n        if len(nums) < 2:\n            return nums\n\n        # we require a sorted list for processing\n        nums = sorted(nums)\n\n        # create root node with value 1 since all other values are divisible by 1\n        # check if 1 is in nums, if not, add it but with depth 0 instead of 1 (and empty subset)\n        if nums[0] != 1:\n            root = Node(val=1, depth=0, subset=[])\n        else:\n            root = Node(val=1, depth=1, subset=[1])\n\n        # track node with maximum depth\n        max_depth_node = [root]\n        # track maximum depth (= length of subset) to not recalculate from subset length\n        max_depth = [0]\n\n        for num in nums[root.depth:]:\n            traverse(root, num)\n\n\t\t# return largest subset\n        return max_depth_node[0].subset\n```\t\t
['Tree', 'Python', 'Python3']