Codility (9) 썸네일형 리스트형 [Lesson 1][Iterations] BinaryGap app.codility.com/programmers/lessons/1-iterations/binary_gap/ BinaryGap coding task - Learn to Code - Codility Find longest sequence of zeros in binary representation of an integer. app.codility.com # 2진수에서 1에 둘러싸인 0의 최대개수 def solution(N): max_v = 0 cnt = 0 flag = False while N: if N % 2 == 1: max_v = max(max_v, cnt) cnt = 0 flag = True else: if flag: cnt += 1 N //= 2 return max_v print(solution.. 이전 1 2 다음