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 e62a0af commit a048c17Copy full SHA for a048c17
number-of-1-bits/doitduri.swift
@@ -0,0 +1,6 @@
1
+class Solution {
2
+ func hammingWeight(_ n: Int) -> Int {
3
+ let bitString = String(n, radix: 2)
4
+ return bitString.filter { $0 == "1" }.count
5
+ }
6
+}
0 commit comments