6 kyu
Bit Counting
6,684 of 254,353xcthulhu
Description:
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234
is 10011010010
, so the function should return 5
in this case
Bits
Algorithms
Similar Kata:
Stats:
Created | Oct 21, 2013 |
Published | Oct 21, 2013 |
Warriors Trained | 507149 |
Total Skips | 61700 |
Total Code Submissions | 602095 |
Total Times Completed | 254353 |
Ruby Completions | 6684 |
CoffeeScript Completions | 269 |
JavaScript Completions | 73385 |
Python Completions | 90888 |
C# Completions | 17963 |
Java Completions | 29054 |
PHP Completions | 6235 |
C Completions | 6598 |
Clojure Completions | 333 |
Rust Completions | 3420 |
Shell Completions | 440 |
NASM Completions | 154 |
Crystal Completions | 52 |
Go Completions | 3572 |
C++ Completions | 12794 |
Scala Completions | 626 |
Swift Completions | 1488 |
Groovy Completions | 94 |
Julia Completions | 165 |
Haskell Completions | 1179 |
TypeScript Completions | 4978 |
Elixir Completions | 267 |
COBOL Completions | 18 |
Prolog Completions | 29 |
Lua Completions | 178 |
D Completions | 22 |
Perl Completions | 5 |
Total Stars | 2542 |
% of votes with a positive feedback rating | 88% of 24247 |
Total "Very Satisfied" Votes | 19014 |
Total "Somewhat Satisfied" Votes | 4781 |
Total "Not Satisfied" Votes | 452 |