C++ clean and clear concise solution || Set
\nclass Solution {\npublic:\n    int countDistinct(vector<int>& nums, int k, int p) \n    {\n        unordered_set<string> s; // use string instead of vector<in
```\nclass Solution {\npublic:\n    int countDistinct(vector<int>& nums, int k, int p) \n    {\n        unordered_set<string> s; // use string instead of vector<int> because it\'s less time consuming\n        int n=nums.size();\n        \n        for(int i=0;i<n;i++)\n        {\n            int count=0;\n            string str="";\n            \n            for(int j=i;j<n;j++)\n            {\n                if(nums[j]%p==0)\n                    count++;\n                \n                if(count>k)\n                    break;\n                \n                str+=to_string(nums[j])+"->";\n                s.insert(str);\n            }\n        }\n        return s.size();\n    }\n};\n```\n\n# Please upvote if you liked this solution.\n# If you have any doubt in this solution, comment down below. I would be more than happy to help you
['C', 'Ordered Set', 'C++']