Java 61ms solution (DFS + pruning) with comments
public class Solution {\n    List<Integer> res;\n    int[] mem;\n    public List<Integer> largestDivisibleSubset(int[] nums) {\n        Arrays.sort(nums);\n    
    public class Solution {\n    List<Integer> res;\n    int[] mem;\n    public List<Integer> largestDivisibleSubset(int[] nums) {\n        Arrays.sort(nums);\n        mem = new int[nums.length];\n        Arrays.fill(mem, -1);\n        res = new ArrayList<>();\n        helper(nums, 0, new ArrayList<>(), 1);\n        return res;\n    }\n    \n    private void helper(int[] nums, int index, List<Integer> curr, int prev) {\n        if (curr.size() > res.size()) {\n            res = new ArrayList<>(curr);\n        }\n        for (int i = index; i < nums.length; i++) {\n            // prune: for the current value, if it has been visited with a larger\n            // set, then skip it\n            if (curr.size() > mem[i] && nums[i] % prev == 0) {\n                mem[i] = curr.size();\n                curr.add(nums[i]);\n                helper(nums, i + 1, curr, nums[i]);\n                curr.remove(curr.size() - 1); // backtrack\n            }\n        }\n    }\n}
['Depth-First Search', 'Java']