Python Binary Gap
def binary_gap(n: int) -> int:
zeroes = bin(n)[2:].strip("0").split("1")
return max((len(z) for z in zeroes), default=0)
This turns the number into binary, ignores zeroes outside the edges, and finds the longest run of zeroes between 1s.