✅✅C++ || Easy To understand solution using set
\nclass Solution\n{\npublic:\n    int countDistinct(vector<int>& nums, int k, int p)\n    {\n        set<vector<int>> visited;\n\n        for (int i = 0; i < nu
```\nclass Solution\n{\npublic:\n    int countDistinct(vector<int>& nums, int k, int p)\n    {\n        set<vector<int>> visited;\n\n        for (int i = 0; i < nums.size(); i++)\n        {\n            int count = 0;\n            vector<int> currSubArray;\n\n            for (int j = i; j < nums.size(); j++)\n            {\n                currSubArray.push_back(nums[j]);\n                if (nums[j] % p == 0)\n                    count++;\n\n                if (count > k)\n                    break;\n\n                visited.insert(currSubArray);\n            }\n        }\n\n        return visited.size();\n    }\n};\n```\nTime Complexity = O(n^2)\ns.c=o(n)
[]