Issue 1 - Hamming Weight
Source:
https://is.gd/lR9u7I
Submissions:
https://is.gd/b99nd2
#### Prelude
Hi folks! In the last LUG--- atm of this writing,
there was a discussion around having community
events, and algo's and CTF's were enthusiastically
proposed. The idea was to have our community hack
on something over on (this past) Sunday, but that
unfortunately never came to be--- I guess people
never just got the bandwidth. That withstanding, I
had volunteered to take up posting an algo problem
every other week as we figure out how to make
those community events more practical; so here we
are!
I'll be scavenging for cool algos, CTFs and post
them as weekly challenges. Let's see how this
goes(I really hope I can keep this up!)
Let's take this as an opportunity to:
- explore new lang features (I've learnt quite a
bit about GUILE this way, and I hope to do so
with Rust);
- get some form of intellectual stimulation;
- prep for interviews in an enjoyable fun way; and
- <insert your awesome reason here>
PS: If you have any cool suggestions, feel free to
reach out to me on mail :)
PSS: Forgive the cheesy subject. It sounds really
nice in my head. It's origin is from some meme
that had been doing the rounds a while back. I
hope it doesn't come off as spammy(?)
#### This Week's Challenge
Write a function that takes an unsigned integer
and returns the number of "1" bits it has.
--8<---------------cut here---------------start------------->8---
Examples:
Input: n = 00000000000001011
Output: 3
Input: n = 0000100000
Output: 1
Input: n = 11111111110
Output: 10
--8<---------------cut here---------------end--------------->8---
Post your solutions as comments to
https://is.gd/b99nd2
--
Bonface M. K. D4F09EB110177E03C28E2FE1F5BBAE1E0392253F
Humble GNU Emacs User / Bearer of scheme-y parens
Curator: <
https://upbookclub.com> / Twitter: @BonfaceKilz