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
8bin(10)
'0b1010'
binary_gap(10)
1
bin(12)
'0b1100'
binary_gap(12)
0
