6 kyu

Bit Counting

6,707 of 257,640xcthulhu

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 Trained513636
Total Skips62201
Total Code Submissions608741
Total Times Completed257640
Ruby Completions6707
CoffeeScript Completions269
JavaScript Completions74250
Python Completions92226
C# Completions18154
Java Completions29373
PHP Completions6285
C Completions6708
Clojure Completions337
Rust Completions3475
Shell Completions442
NASM Completions157
Crystal Completions54
Go Completions3647
C++ Completions13008
Scala Completions635
Swift Completions1504
Groovy Completions97
Julia Completions165
Haskell Completions1195
TypeScript Completions5095
Elixir Completions268
COBOL Completions19
Prolog Completions29
Lua Completions187
D Completions23
Perl Completions10
Total Stars2566
% of votes with a positive feedback rating88% of 24388
Total "Very Satisfied" Votes19124
Total "Somewhat Satisfied" Votes4810
Total "Not Satisfied" Votes454
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