JAVA | SET| EASY
```\nclass Solution {\n    public int countDistinct(int[] nums, int k, int p) {\n        HashSetmap=new HashSet<>();\n        int c=0;\n        for(int i=0;i<nu
```\nclass Solution {\n    public int countDistinct(int[] nums, int k, int p) {\n        HashSet<String>map=new HashSet<>();\n        int c=0;\n        for(int i=0;i<nums.length;i++)\n        {\n            StringBuilder sb=new StringBuilder();\n            c=0;\n            \n            for(int j=i;j<nums.length ;j++)\n            {\n                sb.append(nums[j]+" ");\n                if(nums[j]%p==0) c++;\n                if(c>k)break;\n                \n                map.add(sb.toString());\n            }\n        }\n        return map.size();\n    }\n\n}
[]