leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE |

commit83bdd225a53198c231a454ddc875e7cc9da7c109
parent0287843fd2dee4052bd8546e745cfc049e0e3e52
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateThu, 2 Feb 2023 15:00:43 +0100

Algorithm I: Day 13

Diffstat:
AProblems/0191.cpp|++++++++
MREADME.md|+

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) |