Created
December 29, 2019 03:11
-
-
Save toymak3r/c22d89f38204fd5b7960b8f3cbb30757 to your computer and use it in GitHub Desktop.
Binary Gap in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_gap(N): | |
return len(max(format(N, 'b').strip('0').split('1'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment