6 kyu

Bit Counting

91,072 of 254,830xcthulhu

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

Stats:

CreatedOct 21, 2013
PublishedOct 21, 2013
Warriors Trained508137
Total Skips61765
Total Code Submissions603112
Total Times Completed254830
Ruby Completions6685
CoffeeScript Completions269
JavaScript Completions73504
Python Completions91072
C# Completions17996
Java Completions29107
PHP Completions6238
C Completions6622
Clojure Completions334
Rust Completions3426
Shell Completions440
NASM Completions154
Crystal Completions54
Go Completions3583
C++ Completions12823
Scala Completions627
Swift Completions1491
Groovy Completions95
Julia Completions165
Haskell Completions1180
TypeScript Completions5001
Elixir Completions267
COBOL Completions18
Prolog Completions29
Lua Completions180
D Completions22
Perl Completions5
Total Stars2543
% of votes with a positive feedback rating88% of 24262
Total "Very Satisfied" Votes19028
Total "Somewhat Satisfied" Votes4782
Total "Not Satisfied" Votes452
Ad
Contributors
  • xcthulhu Avatar
  • jhoffner Avatar
  • Javatlacati Avatar
  • user3482173 Avatar
  • GiacomoSorbi Avatar
  • jFrench661 Avatar
  • suic Avatar
  • brunolm Avatar
  • samhstn Avatar
  • mcamuzat Avatar
  • jetjake Avatar
  • Chrono79 Avatar
  • kazk Avatar
  • JohanWiltink Avatar
  • B1ts Avatar
  • lilsweetcaligula Avatar
  • jbristow Avatar
  • acjoker Avatar
  • Voile Avatar
  • Souzooka Avatar
  • FArekkusu Avatar
  • vp217 Avatar
  • DrLecter Avatar
  • hobovsky Avatar
  • zaxy78 Avatar
  • xavierguihot Avatar
  • stellartux Avatar
  • trashy_incel Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • FandaL Avatar
  • cwps Avatar
  • KayleighWasTaken Avatar
  • lv70 Avatar
Ad