Skip to content

Commit 4155591

Browse files
committed
docs: kata description
1 parent df9b1ec commit 4155591

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# [Count the Ones](https://www.codewars.com/kata/count-the-ones "https://www.codewars.com/kata/5519e930cd82ff8a9a000216")
2+
3+
The __Hamming weight__ of a string is the number of symbols that are different from the zero-symbol of the alphabet used. There are several algorithms for efficient computing of the Hamming weight for numbers. In this Kata, speaking technically, you have to find out the number of '1' bits in a binary representation of a number. Thus,
4+
5+
```ruby
6+
hamming_weight(10) # 1010 => 2
7+
hamming_weight(21) # 10101 => 3
8+
```
9+
```javascript
10+
hammingWeight(10) // 1010 => 2
11+
hammingWeight(21) // 10101 => 3
12+
```
13+
14+
The interesting part of this task is that you have to do it *without* string operation (hey, it's not really interesting otherwise)
15+
16+
;)

kata/7-kyu/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
- [Count consonants](count-consonants "564e7fc20f0b53eb02000106")
120120
- [Count the Digit](count-the-digit "566fc12495810954b1000030")
121121
- [Count the divisors of a number](count-the-divisors-of-a-number "542c0f198e077084c0000c2e")
122+
- [Count the Ones](count-the-ones "5519e930cd82ff8a9a000216")
122123
- [Covfefe](covfefe "592fd8f752ee71ac7e00008a")
123124
- [Create palindrome](create-palindrome "5b7bd90ef643c4df7400015d")
124125
- [Credit card issuer checking](credit-card-issuer-checking "5701e43f86306a615c001868")

0 commit comments

Comments
 (0)