We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8da536 commit 712128fCopy full SHA for 712128f
Javascript/distinctCount.js
@@ -0,0 +1,11 @@
1
+//Complete the function distinctCount() to return the number of distinct elements in the input array.
2
+
3
+function distinctCount(array) {
4
+ const myset = new Set()
5
+ for(const num of array){
6
+ myset.add(num)
7
+ }
8
+ return myset.size
9
+}
10
11
+module.exports = distinctCount;
0 commit comments