commit 83bdd225a53198c231a454ddc875e7cc9da7c109
parent 0287843fd2dee4052bd8546e745cfc049e0e3e52
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Thu, 2 Feb 2023 16:00:43 +0100
Algorithm I: Day 13
Diffstat:
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/Problems/0191.cpp b/Problems/0191.cpp
@@ -0,0 +1,8 @@
+class Solution {
+public:
+ int hammingWeight(uint32_t n) {
+ int res = 0;
+ while (n) res += n & 1, n >>= 1;
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -114,6 +114,7 @@ for solving problems.
| 0167 | Medium | [Two Sum II - Input Array Is Sorted](Problems/0167.cpp) |
| 0173 | Medium | [Binary Search Tree Iterator](Problems/0173.cpp) |
| 0189 | Medium | [Rotate Array](Problems/0189.cpp) |
+| 0191 | Easy | [Number of 1 Bits](Problems/0191.cpp) |
| 0192 | Medium | [Word Frequency](Problems/0192.sh) |
| 0193 | Easy | [Valid Phone Numbers](Problems/0193.sh) |
| 0194 | Medium | [Transpose File](Problems/0194.sh) |