from a coding challenge i found
Count the bits - 3 points
find the fastest way to count the number of bits set in an integer
example...
Decimal 13 = binary 1101
Answer 3 bits set
Info: didn't knw what a bits set was bits sets
Solution
- python:
bin(13).count('1')
- js:
.toString(2).match(/1/g)
trasure hunt - 5 points
below are treasure chests each has visible prices inside but costs $ to unlock. Given a set of prices wyou want what chests should you unlock to spend the least $?