DEV Community

Discussion on: Daily Coding Puzzles - Oct 29th - Nov 2nd

Collapse
 
aspittel profile image
Ali Spittel

My Python solution:

def binary_array_to_number(arr):
    return int(''.join(str(i) for i in arr), 2)
Collapse
 
tux0r profile image
tux0r

This will cause problems on Python 2 where int has a maximum value which is easily exceeded.

Thread Thread
 
aspittel profile image
Ali Spittel

true -- I'm on Python 3 though and the test cases are all small

Thread Thread
 
tux0r profile image
tux0r

"Nobody will notice" is a developer's worst enemy. ;-)