C++ | 100% FASTER | DYNAMIC PROGRAMMING
\nclass Solution {\npublic:\n    vector<int> largestDivisibleSubset(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        vector<int> dp[nums.s
```\nclass Solution {\npublic:\n    vector<int> largestDivisibleSubset(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        vector<int> dp[nums.size()];\n        int idx=0;\n        for(int i = 0; i < nums.size(); i++){\n            for(int j = 0; j <= i; j++){\n                if(nums[i]%nums[j] == 0) {\n                    if(dp[i].size() <= dp[j].size())\n                    {\n                        dp[i] = dp[j];\n                    }\n                }\n            }\n            dp[i].push_back(nums[i]);\n            if(dp[i].size() >= dp[idx].size()) idx = i;\n        }     \n        return dp[idx];\n    }\n};\n```
['Dynamic Programming', 'C']