Back to Browse

Technical Interview: Count ones in binary representation

3.3K views
Oct 4, 2017
7:53

Problem: Problem: Find the number of 1s in the binary representation of a number. For example: num_ones(2) = 1 -- since "10" is the binary representation of the number "2". num_ones(5) = 2 -- since "101" is the binary representation of the number "5" num_ones(11) = 3 -- since "1011" is the binary representation of the number "11" This video is part of the "Technical Interview Problems" series on various problems that arise in a technical interview setting. The solutions in this series focus on the Python language: https://goo.gl/nM8M5B The code used in this video may be found here: https://github.com/vprusso/youtube_tutorials/blob/master/technical_interview/ones_binary.py The code used in this video may be found here: https://github.

Download

1 formats

Video Formats

360pmp49.1 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Technical Interview: Count ones in binary representation | NatokHD