프로그래머스 Lv.2| Python - 다음 큰 숫자

pg

풀이

def solution(n):

    count = bin(n).count('1')
    
    for i in range(n+1, 1000001):
        if count == bin(i).count('1'):
            return i

comments powered by Disqus