7 kyu

Delta Bits

819 of 3,408ykagan

Description:

Complete the function to determine the number of bits required to convert integer A to integer B (where A and B >= 0)

The upper limit for A and B is 216, int.MaxValue or similar.

For example, you can change 31 to 14 by flipping the 4th and 0th bit:

 31  0 0 0 1 1 1 1 1
 14  0 0 0 0 1 1 1 0
---  ---------------
bit  7 6 5 4 3 2 1 0

Thus 31 and 14 should return 2.

Bits
Binary
Algorithms

Stats:

CreatedMay 31, 2014
PublishedMay 31, 2014
Warriors Trained6277
Total Skips1017
Total Code Submissions14984
Total Times Completed3408
JavaScript Completions819
Ruby Completions386
CoffeeScript Completions37
Java Completions1243
C# Completions160
Python Completions710
NASM Completions31
C Completions188
Rust Completions36
Haskell Completions16
Total Stars73
% of votes with a positive feedback rating92% of 565
Total "Very Satisfied" Votes480
Total "Somewhat Satisfied" Votes75
Total "Not Satisfied" Votes10
Ad
Contributors
  • ykagan Avatar
  • jhoffner Avatar
  • hbakhtiyor Avatar
  • jamiely Avatar
  • pablo.varela Avatar
  • anter69 Avatar
  • nguyen_v Avatar
  • JohanWiltink Avatar
  • FArekkusu Avatar
  • monadius Avatar
  • hobovsky Avatar
  • stellartux Avatar
  • akar-0 Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad