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 707e607 commit 8f8cd79Copy full SHA for 8f8cd79
number-of-1-bits/hyer0705.ts
@@ -0,0 +1,5 @@
1
+function hammingWeight(n: number): number {
2
+ const RADIX = 2;
3
+
4
+ return n.toString(RADIX).match(/1/g)?.length || 0;
5
+}
0 commit comments