Find a binary gap
Gần đây, mình gặp 1 bài toán khá đơn giản, nhưng thú vị như sau:
Input: A number
Output: The maximum 0 is written between the two numbers 1 in binary form with the fastest possible speed.
Ví dụ:1
2
3
4
5
6
7
810) bin(
'0b1010'
10) binary_gap(
1
12) bin(
'0b1100'
12) binary_gap(
0