We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ac829f commit 3d120d4Copy full SHA for 3d120d4
number-of-1-bits/Kyojin-Hwang.js
@@ -0,0 +1,10 @@
1
+/**
2
+ * @param {number} n
3
+ * @return {number}
4
+ */
5
+var hammingWeight = function (n) {
6
+ return n
7
+ .toString(2)
8
+ .split("")
9
+ .filter((bit) => bit === "1").length;
10
+};
0 commit comments