✅✅Best Solution in C++ || DP(Memoization)💯✅
Code\nPLease Upvote if u liked my Solution\uD83D\uDE42\n\nclass Solution {\npublic:\n    vector<int> ans;\n    void helper(int i,vector<int>& nums,vector<int>& 
# Code\n**PLease Upvote if u liked my Solution**\uD83D\uDE42\n```\nclass Solution {\npublic:\n    vector<int> ans;\n    void helper(int i,vector<int>& nums,vector<int>& vec,vector<int>& dp){\n        if(i==nums.size()){\n            if(vec.size()>ans.size())\n                ans=vec;\n            return;\n        }\n        if(vec.size()==0){\n            vec.push_back(nums[i]);\n            helper(i+1,nums,vec,dp);\n            vec.pop_back();\n        }\n        else if((int)vec.size()>dp[i] && nums[i]%vec.back()==0){\n            dp[i]=vec.size();\n            vec.push_back(nums[i]);\n            helper(i+1,nums,vec,dp);\n            vec.pop_back();\n        }\n        helper(i+1,nums,vec,dp);\n    }\n    vector<int> largestDivisibleSubset(vector<int>& nums) {\n        vector<int> vec;\n        vector<int> dp(nums.size()+1,-1);\n        sort(nums.begin(),nums.end());\n        helper(0,nums,vec,dp);\n        return ans;\n    }\n};\n```
['Backtracking', 'Memoization', 'C++']