Guidewire Interview Question

one task was to solve BinaryGap