[Java] Simple HashSet Solution (Easy to understand)
\tclass Solution {\n\t\tpublic int countDistinct(int[] nums, int k, int p) {\n\t\t\tHashSet hs = new HashSet<>();\n\n\t\t\tfor(int i=0; i<nums.length; ++i) {\n\
\tclass Solution {\n\t\tpublic int countDistinct(int[] nums, int k, int p) {\n\t\t\tHashSet<String> hs = new HashSet<>();\n\n\t\t\tfor(int i=0; i<nums.length; ++i) {\n\t\t\t\tint cnt = 0;\n\t\t\t\tStringBuilder sb = new StringBuilder();\n\n\t\t\t\tfor(int j=i; j<nums.length; ++j) {\n\n\t\t\t\t\tif(nums[j]%p == 0) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(cnt > k) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tsb.append(nums[j] + ",");\n\n\t\t\t\t\ths.add(sb.toString());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn hs.size();\n\t\t}\n\n\t}
['Java']